-1

我在 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)))
4

1 回答 1

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
于 2014-03-26T20:05:38.193 回答