我是Julia的新用户,我想使用图表。我找到了Graphs.jl库,但没有很好的文档。我试图创建一个基于ExVertex和ExEdge的ExVertex,但我需要更多的信息。
我使用的代码:
using Graphs
CompGraph = GenericGraph{ExVertex, ExEdge{ExVertex}}
temp = ExVertex(1, "VertexName")
temp.attributes["Att"] = "Test"
add_vertex!(CompGraph, temp)现在我仍然需要ExVertex列表和ExEdge列表。是否有任何定义的参数?或者我怎样才能创建这样的清单?
发布于 2015-12-09 10:38:33
解决办法太简单了。列表只是一个简单的数组,而不是一个新的类型。此外,还有一个简单的定义函数,它根据不同类型的边和草创建图。
我把我的代码改为:
using Graphs
CG_VertexList = ExVertex[]
CG_EdgeList = ExEdge{ExVertex}[]
CompGraph = graph(CG_VertexList, CG_EdgeList)
temp = ExVertex(1, "VertexName")
temp.attributes["Att"] = "Test"
add_vertex!(CompGraph, temp)https://stackoverflow.com/questions/34159432
复制相似问题