当前位置: 首页>>代码示例>>C#>>正文


C# IGraph.GetValue方法代码示例

本文整理汇总了C#中IGraph.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IGraph.GetValue方法的具体用法?C# IGraph.GetValue怎么用?C# IGraph.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGraph的用法示例。


在下文中一共展示了IGraph.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: typeof

    TryGetGroups
    (
        IGraph graph,
        out GroupInfo [] groups
    )
    {
        Debug.Assert(graph != null);

        groups = ( GroupInfo[] )graph.GetValue(
            ReservedMetadataKeys.GroupInfo, typeof( GroupInfo[] ) );

        return (groups != null && groups.Length > 0);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:13,代码来源:GroupUtil.cs

示例2: AssertValid

    LayOutSmallerComponentsInBins
    (
        IGraph graph,
        ICollection<IVertex> verticesToLayOut,
        LayoutContext layoutContext,
        out ICollection<IVertex> remainingVertices,
        out Rectangle remainingRectangle
    )
    {
        AssertValid();

        remainingVertices = null;
        remainingRectangle = Rectangle.Empty;

        // This method modifies some of the graph's metadata.  Save the
        // original metadata.

        Boolean bOriginalGraphHasBeenLaidOut =
            LayoutMetadataUtil.GraphHasBeenLaidOut(graph);

        ICollection<IVertex> oOriginalLayOutTheseVerticesOnly =
            ( ICollection<IVertex> )graph.GetValue(
                ReservedMetadataKeys.LayOutTheseVerticesOnly,
                typeof( ICollection<IVertex> ) );

        // Split the vertices into strongly connected components, sorted in
        // increasing order of vertex count.

        ConnectedComponentCalculator oConnectedComponentCalculator =
            new ConnectedComponentCalculator();

        IList< LinkedList<IVertex> > oComponents =
            oConnectedComponentCalculator.CalculateStronglyConnectedComponents(
                verticesToLayOut, graph, true);

        Int32 iComponents = oComponents.Count;

        // This object will split the graph rectangle into bin rectangles.

        RectangleBinner oRectangleBinner = new RectangleBinner(
            layoutContext.GraphRectangle, m_iBinLength);

        Int32 iComponent = 0;

        for (iComponent = 0; iComponent < iComponents; iComponent++)
        {
            LinkedList<IVertex> oComponent = oComponents[iComponent];
            Int32 iVerticesInComponent = oComponent.Count;

            if (iVerticesInComponent> m_iMaximumVerticesPerBin)
            {
                // The vertices in the remaining components should not be
                // binned.

                break;
            }

            Rectangle oBinRectangle;

            if ( !oRectangleBinner.TryGetNextBin(out oBinRectangle) )
            {
                // There is no room for an additional bin rectangle.

                break;
            }

            // Lay out the component within the bin rectangle.

            LayOutComponentInBin(graph, oComponent, oBinRectangle);
        }

        // Restore the original metadata on the graph.

        if (bOriginalGraphHasBeenLaidOut)
        {
            LayoutMetadataUtil.MarkGraphAsLaidOut(graph);
        }
        else
        {
            LayoutMetadataUtil.MarkGraphAsNotLaidOut(graph);
        }

        if (oOriginalLayOutTheseVerticesOnly != null)
        {
            graph.SetValue(ReservedMetadataKeys.LayOutTheseVerticesOnly,
                oOriginalLayOutTheseVerticesOnly);
        }
        else
        {
            graph.RemoveKey(ReservedMetadataKeys.LayOutTheseVerticesOnly);
        }

        if ( oRectangleBinner.TryGetRemainingRectangle(
            out remainingRectangle) )
        {
            remainingVertices = GetRemainingVertices(oComponents, iComponent);

            return (remainingVertices.Count > 0);
        }

//.........这里部分代码省略.........
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:101,代码来源:GraphBinner.cs

示例3: typeof

    GetImportedGraphMLFileDescription
    (
        String graphMLFileName,
        IGraph graph
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(graphMLFileName) );
        Debug.Assert(graph != null);

        // If the graph already has a description, use it.
        //
        // This can occur, for example, if the GraphML was imported from a file
        // created by the NetworkServer command line program, which stores a
        // description in the GraphML.

        String sImportedGraphMLFileDescription = (String)graph.GetValue(
            ReservedMetadataKeys.GraphDescription, typeof(String) );

        if ( String.IsNullOrEmpty(sImportedGraphMLFileDescription) )
        {
            sImportedGraphMLFileDescription = GetImportedFileDescription(
                "GraphML file", graphMLFileName);
        }

        return (sImportedGraphMLFileDescription);
    }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:26,代码来源:GraphImporter.cs


注:本文中的IGraph.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。