QuickGraph - 如何将边与类关联? (即就像使用顶点一样)
Q1 - 如何将边缘与类关联? (即就像使用顶点一样)
就我而言,我希望能够对各种类型的边进行建模。所以我想我真正的问题是如何将某种级别的数据与边缘(例如边缘类型)相关联。
我正在查看使用的图表是: http://quickgraph.codeplex.com /wikipage?title=Bi DirectionGraph&referringTitle=文档
谢谢
Q1 - How can I associate an Edge with a Class? (i.e. like you can with a Vertex)
In my case there are various types of edges I want to be able to model. So my real question I guess is how can I associate some level of data with Edges (e.g. edge type).
The graph I was looking at using was: http://quickgraph.codeplex.com/wikipage?title=BidirectionalGraph&referringTitle=Documentation
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,边仅连接图上的两个顶点。如果您需要与边关联的更多信息(即“关系”),可以实现
IEdge
接口或子类Edge
。然后,在自定义边缘类中,您可以存储与该边缘相关的信息。即
...稍后
An edge by default only connects two vertices on the graph. If you need more information associated with an edge (i.e. a "Relationship"), you can implement the
IEdge<T>
interfaces or subclassEdge<T>
. Then, in your custom edge class you can store the information that's relevant to that edge.i.e.
... later
您还可以使用 TaggedEdge 类,它允许您将任意对象与每条边关联起来。
You can also use the TaggedEdge class, which allows you to associate an arbitrary object with each edge.