質問編集履歴

1

現状のコード、現状の図記載

2019/08/22 12:50

投稿

Kento-foot
Kento-foot

スコア5

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- matplotlibとnetworkxをつかって
5
+ networkxをつかって
6
6
 
7
7
  ノード間に2つのエッジを表示させたいです。
8
8
 
@@ -20,6 +20,32 @@
20
20
 
21
21
 
22
22
 
23
+ ###ソースコード
24
+
25
+ import networkx as nx
26
+
27
+
28
+
29
+ G = nx.MultiDiGraph()
30
+
31
+ G.add_nodes_from([1,2])
32
+
33
+ G.add_edge(1,2,weight=1)
34
+
35
+ G.add_edge(2,1,weight=2)
36
+
37
+ pos = nx.spring_layout(G)
38
+
39
+ edges_weight = [d["weight"] for (u,v,d) in G.edges(data=True)]
40
+
41
+ nx.draw_networkx_nodes(G,pos)
42
+
43
+ nx.draw_networkx_edges(G,pos,width=edges_weight)
44
+
45
+
46
+
47
+ ![イメージ説明](8c7c8dd8aaed792edcd1dd8aee874e1a.png)
48
+
23
49
  Python3.7.0
24
50
 
25
51