Example #1
0
        TryGetEdgeKey
        (
            Int32 iRowOneBased,
            Object [,] aoVertex1NameValues,
            Object [,] aoVertex2NameValues,
            Object [,] aoThirdColumnValues,
            Boolean bGraphIsDirected,
            out String sEdgeKey
        )
        {
            Debug.Assert(iRowOneBased >= 1);
            Debug.Assert(aoVertex1NameValues != null);
            Debug.Assert(aoVertex2NameValues != null);
            AssertValid();

            sEdgeKey = null;

            String sVertex1Name, sVertex2Name;

            if (
                !ExcelUtil.TryGetNonEmptyStringFromCell(aoVertex1NameValues,
                                                        iRowOneBased, 1, out sVertex1Name)
                ||
                !ExcelUtil.TryGetNonEmptyStringFromCell(aoVertex2NameValues,
                                                        iRowOneBased, 1, out sVertex2Name)
                )
            {
                return(false);
            }

            sEdgeKey = EdgeUtil.GetVertexNamePair(sVertex1Name, sVertex2Name,
                                                  bGraphIsDirected);

            String sThirdColumnValue;

            if (
                aoThirdColumnValues != null
                &&
                ExcelUtil.TryGetNonEmptyStringFromCell(aoThirdColumnValues,
                                                       iRowOneBased, 1, out sThirdColumnValue)
                )
            {
                sEdgeKey += EdgeUtil.VertexNamePairSeparator;
                sEdgeKey += sThirdColumnValue;
            }

            return(true);
        }
Example #2
0
 TestGetVertexNamePair2()
 {
     Assert.AreEqual("B\vA", EdgeUtil.GetVertexNamePair("B", "A", true));
 }
Example #3
0
 TestGetVertexNamePair4()
 {
     Assert.AreEqual("A\vB", EdgeUtil.GetVertexNamePair("B", "A", false));
 }
Example #4
0
 TestGetVertexNamePair()
 {
     Assert.AreEqual("A\vB", EdgeUtil.GetVertexNamePair("A", "B", true));
 }