本文整理汇总了C#中IVertex.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# IVertex.ContainsKey方法的具体用法?C# IVertex.ContainsKey怎么用?C# IVertex.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertex
的用法示例。
在下文中一共展示了IVertex.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTarjanAlgorithm
//*************************************************************************
// Method: RunTarjanAlgorithm()
//
/// <summary>
/// Runs the Tarjan algorithm on one vertex.
/// </summary>
///
/// <param name="oVertex">
/// The vertex to run the algorithm on.
/// </param>
///
/// <param name="oStack">
/// Stack used by the algorithm.
/// </param>
///
/// <param name="oStronglyConnectedComponents">
/// List to add the strongly connected components to.
/// </param>
///
/// <param name="iNextIndex">
/// Index to assign to <paramref name="oVertex" />. Gets incremented.
/// </param>
//*************************************************************************
protected void RunTarjanAlgorithm(
IVertex oVertex,
Stack<IVertex> oStack,
List< LinkedList<IVertex> > oStronglyConnectedComponents,
ref Int32 iNextIndex
)
{
Debug.Assert(oVertex != null);
Debug.Assert( !oVertex.ContainsKey(
ReservedMetadataKeys.ConnectedComponentCalculatorIndex) );
Debug.Assert(oStack != null);
Debug.Assert(oStronglyConnectedComponents != null);
Debug.Assert(iNextIndex >= 0);
SetIndex(oVertex, iNextIndex);
SetLowLink(oVertex, iNextIndex);
iNextIndex++;
oStack.Push(oVertex);
foreach (IEdge oIncidentEdge in oVertex.IncidentEdges)
{
IVertex oAdjacentVertex = oIncidentEdge.GetAdjacentVertex(oVertex);
if ( !oAdjacentVertex.ContainsKey(
ReservedMetadataKeys.ConnectedComponentCalculatorIndex) )
{
RunTarjanAlgorithm(oAdjacentVertex, oStack,
oStronglyConnectedComponents, ref iNextIndex);
SetLowLink(oVertex,
Math.Min(GetLowLink(oVertex), GetLowLink(oAdjacentVertex) )
);
}
else if ( oStack.Contains(oAdjacentVertex) )
{
SetLowLink(oVertex,
Math.Min( GetLowLink(oVertex), GetIndex(oAdjacentVertex) )
);
}
}
if ( GetLowLink(oVertex) == GetIndex(oVertex) )
{
LinkedList<IVertex> oStronglyConnectedComponent =
new LinkedList<IVertex>();
IVertex oVertexInComponent;
do
{
oVertexInComponent = oStack.Pop();
oStronglyConnectedComponent.AddLast(oVertexInComponent);
} while (oVertexInComponent.ID != oVertex.ID);
oStronglyConnectedComponents.Add(oStronglyConnectedComponent);
}
}
示例2: DrawSimpleShape
//.........这里部分代码省略.........
oDrawingContext.DrawRectangle(
bIsSolidSquare ? GetBrush(oColor) : Brushes.Transparent,
bIsSolidSquare? null : GetPen(oColor, DefaultPenThickness),
oVertexBounds
);
oVertexDrawingHistory = bIsSolidSquare ?
new SolidSquareVertexDrawingHistory(oVertex,
oDrawingVisual, bDrawAsSelected, oVertexBounds)
:
new SquareVertexDrawingHistory(oVertex,
oDrawingVisual, bDrawAsSelected, oVertexBounds);
break;
case VertexShape.Diamond:
case VertexShape.SolidDiamond:
Boolean bIsSolidDiamond = (eShape == VertexShape.SolidDiamond);
PathGeometry oDiamond =
WpfGraphicsUtil.DiamondFromCenterAndHalfWidth(
oLocation, dRadius);
oDrawingContext.DrawGeometry(
bIsSolidDiamond ? GetBrush(oColor) : Brushes.Transparent,
bIsSolidDiamond ? null :
GetPen(oColor, DefaultPenThickness),
oDiamond
);
oVertexDrawingHistory = bIsSolidDiamond ?
new SolidDiamondVertexDrawingHistory(
oVertex, oDrawingVisual, bDrawAsSelected, dRadius)
:
new DiamondVertexDrawingHistory(
oVertex, oDrawingVisual, bDrawAsSelected, dRadius);
break;
case VertexShape.Triangle:
case VertexShape.SolidTriangle:
Boolean bIsSolidTriangle =
(eShape == VertexShape.SolidTriangle);
PathGeometry oTriangle =
WpfGraphicsUtil.TriangleFromCenterAndHalfWidth(
oLocation, dRadius);
oDrawingContext.DrawGeometry(
bIsSolidTriangle ? GetBrush(oColor) : Brushes.Transparent,
bIsSolidTriangle ? null :
GetPen(oColor, DefaultPenThickness),
oTriangle
);
oVertexDrawingHistory = bIsSolidTriangle ?
new SolidTriangleVertexDrawingHistory(
oVertex, oDrawingVisual, bDrawAsSelected, dRadius)
:
new TriangleVertexDrawingHistory(
oVertex, oDrawingVisual, bDrawAsSelected, dRadius);
break;
default:
Debug.Assert(false);
break;
}
if (sAnnotation != null)
{
oVertexLabelDrawer.DrawLabel( oDrawingContext,
oGraphDrawingContext, oVertexDrawingHistory, oVertexBounds,
CreateFormattedText(sAnnotation, oColor) );
}
if ( oVertex.ContainsKey(ReservedMetadataKeys.PerVertexDrawPlusSign) )
{
DrawPlusSign(eShape, oVertexLocation, oVertexBounds, oColor,
oGraphDrawingContext, oDrawingContext, oVertexLabelDrawer,
oVertexDrawingHistory);
}
Debug.Assert(oVertexDrawingHistory != null);
return (oVertexDrawingHistory);
}