can we set seed into multigraph function from netgraph module in python? i have tried set seed with this code but it keeps changing everytime i run the code.
<code>import networkx as nx
import matplotlib.pyplot as plt
from netgraph import MultiGraph
import pandas as pd
G = nx.MultiDiGraph()
G.add_node('Surabaya')
G.add_node('Yogyakarta')
G.add_node('Bali')
G.add_node('Semarang')
G.add_node('Medan')
G.add_node('Makassar')
G.add_node('Padang')
G.add_node('Palembang')
G.add_node('Jakarta')
G.add_node('Bandung')
df = pd.read_csv("data.csv")
for x,y,z in zip(df['Asal'],df['Tujuan'],df['Ongkos']):
G.add_edge(str(x), str(y), weight=z)
plt.figure(figsize=(12,12))
MultiGraph(
G,
node_labels=True,
node_color="skyblue",
node_size=4.25,
node_label_fontdict=dict(fontsize=8),
edge_color="gray",
edge_labels=nx.get_edge_attributes(G, 'weight'),
edge_label_fontdict=dict(fontsize=9),
arrows=True
)
plt.show()
</code>
<code>import networkx as nx
import matplotlib.pyplot as plt
from netgraph import MultiGraph
import pandas as pd
G = nx.MultiDiGraph()
G.add_node('Surabaya')
G.add_node('Yogyakarta')
G.add_node('Bali')
G.add_node('Semarang')
G.add_node('Medan')
G.add_node('Makassar')
G.add_node('Padang')
G.add_node('Palembang')
G.add_node('Jakarta')
G.add_node('Bandung')
df = pd.read_csv("data.csv")
for x,y,z in zip(df['Asal'],df['Tujuan'],df['Ongkos']):
G.add_edge(str(x), str(y), weight=z)
plt.figure(figsize=(12,12))
MultiGraph(
G,
node_labels=True,
node_color="skyblue",
node_size=4.25,
node_label_fontdict=dict(fontsize=8),
edge_color="gray",
edge_labels=nx.get_edge_attributes(G, 'weight'),
edge_label_fontdict=dict(fontsize=9),
arrows=True
)
plt.show()
</code>
import networkx as nx
import matplotlib.pyplot as plt
from netgraph import MultiGraph
import pandas as pd
G = nx.MultiDiGraph()
G.add_node('Surabaya')
G.add_node('Yogyakarta')
G.add_node('Bali')
G.add_node('Semarang')
G.add_node('Medan')
G.add_node('Makassar')
G.add_node('Padang')
G.add_node('Palembang')
G.add_node('Jakarta')
G.add_node('Bandung')
df = pd.read_csv("data.csv")
for x,y,z in zip(df['Asal'],df['Tujuan'],df['Ongkos']):
G.add_edge(str(x), str(y), weight=z)
plt.figure(figsize=(12,12))
MultiGraph(
G,
node_labels=True,
node_color="skyblue",
node_size=4.25,
node_label_fontdict=dict(fontsize=8),
edge_color="gray",
edge_labels=nx.get_edge_attributes(G, 'weight'),
edge_label_fontdict=dict(fontsize=9),
arrows=True
)
plt.show()
New contributor
salwa alifah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.