Henrick:
Graphs are composed of vertices and edges.
You are asking about converting a list of number pairs into edges.
First, don’t use “rule” to denote an edge.
Instead, use either Directed Edge or Undirected Edge .
These are typed <esc>de<esc> and <esc>ue<esc> respectively.
You have given the list {{2, 6}, {2 , 4}, {4, 5},{ 5, 6}} as example of number pairs
to be converted to graph edges. Here’s a few ways to accomplish that:
Graphs are composed of vertices and edges.
You are asking about converting a list of number pairs into edges.
First, don’t use “rule” to denote an edge.
Instead, use either Directed Edge or Undirected Edge .
These are typed <esc>de<esc> and <esc>ue<esc> respectively.
You have given the list {{2, 6}, {2 , 4}, {4, 5},{ 5, 6}} as example of number pairs
to be converted to graph edges. Here’s a few ways to accomplish that:
In[]:=
hrkarray={{2,6},{2,4},{4,5},{5,6}};edges1=Table[hrkarray[[i,1]]hrkarray[[i,2]],{i,1,Length[hrkarray]}];edges2=(#[[1]]#[[2]])&/@hrkarray;g1=Graph[edges1,VertexStyleBlack,VertexSizeTiny,VertexLabelsNone,EdgeStyleBlack,EdgeLabelsPlaced[All,{Right,"Middle"}],GraphLayout"TutteEmbedding",ImageSize128];g2=Graph[edges2,VertexStyleBlue,VertexSizeSmall,VertexLabelsPlaced[All,Before],EdgeStyleRed,GraphLayout"SpiralEmbedding",ImageSize128];Print[Row[{g1,g2},Spacer[32]]];