本文整理汇总了C#中Vertex.GetEdges方法的典型用法代码示例。如果您正苦于以下问题:C# Vertex.GetEdges方法的具体用法?C# Vertex.GetEdges怎么用?C# Vertex.GetEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertex
的用法示例。
在下文中一共展示了Vertex.GetEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findsEdge
// Finds an Edge given both of its vertices
public EdgeIfc findsEdge( Vertex theSource,
Vertex theTarGet )
{
EdgeIfc theEdge;
// dja: performance improvement
// for( Iterator<EdgeIfc> edgeiter = GetEdges(); edgeiter.hasNext(); )
for( Iterator<EdgeIfc> edgeiter = theSource.GetEdges(); edgeiter.hasNext(); )
{
theEdge = edgeiter.next();
if ( ( theEdge.GetStart().GetName().Equals( theSource.GetName() ) &&
theEdge.GetEnd().GetName().Equals( theTarGet.GetName() ) ) ||
( theEdge.GetStart().GetName().Equals( theTarGet.GetName() ) &&
theEdge.GetEnd().GetName().Equals( theSource.GetName() ) ) )
return theEdge;
}
return null;
}
示例2: CalculateTotalTo
int CalculateTotalTo(Vertex supplier, EdgeType supplierWarehouseEdgeType, EdgeType moveToEdgeType, PropertyType howManyProperty, Vertex toVertex)
{
int total = 0;
HashSet<Vertex> excludeSet = new HashSet<Vertex>();
HashSet<EdgeType> edgeTypesToTraverse = new HashSet<EdgeType>();
edgeTypesToTraverse.Add(moveToEdgeType);
foreach (IEdge wareHouseEdge in supplier.GetEdges(supplierWarehouseEdgeType, Direction.Out))
{
Vertex supplierWareHouse = (Vertex)wareHouseEdge.GetVertex(Direction.In);
var allPaths = supplierWareHouse.Traverse(10, true, Direction.Out, toVertex, edgeTypesToTraverse, null, null, null, excludeSet);
foreach (List<Edge> path in allPaths)
{
if (path.Count > 0)
total += (int)path.Last().GetProperty(howManyProperty); // last because that is all we care about in this simplified sample
foreach (Edge edge in path)
{
excludeSet.Add(edge.Tail);
}
}
}
return total;
}