在GraphSharp中的边缘上添加标签

时间:2013-10-28 19:08:53

标签: vb.net graph-sharp

我在VB.net中使用Graph#我可以轻松地在其中添加节点和边缘但是如何在这些边缘添加标签? 任何人都可以提供帮助......

这是我添加节点和边缘的代码

Dim g = New CompoundGraph(Of Object, IEdge(Of Object))()

Dim vertices = New String(29) {}
   For i As Integer = 0 To 29
      vertices(i) = i.ToString()
      g.AddVertex(vertices(i))
   Next i

g.AddEdge(New Edge(Of Object)(vertices(0), vertices(1)))

1 个答案:

答案 0 :(得分:0)

Dim g = New BidirectionalGraph(Of Object, IEdge(Of Object))()

'add the vertices to the graph
Dim vertices As String() = New String(4) {}
For i As Integer = 0 To 4
   vertices(i) = i.ToString()
   g.AddVertex(vertices(i))
Next

'add some edges to the graph
g.AddEdge(New Edge(Of Object)(vertices(0), vertices(1)))
g.AddEdge(New Edge(Of Object)(vertices(1), vertices(2)))
g.AddEdge(New Edge(Of Object)(vertices(2), vertices(3)))
g.AddEdge(New Edge(Of Object)(vertices(3), vertices(1)))
g.AddEdge(New Edge(Of Object)(vertices(1), vertices(4)))

_graphToVisualize = g