Esempio n. 1
0
        public void TestRNode_int_int()
        {
            RNode node = new RNode(1, 2);

            Assert.IsNotNull(node);
            Assert.IsNotNull(node.Extension);
            Assert.IsNotNull(node.Forbidden);
        }
Esempio n. 2
0
        /// <summary>
        ///  Converts a RGraph bitset (set of RNode)
        /// to a list of RMap that represents the
        /// mapping between to substructures in G1 and G2
        /// (the projection of the RGraph bitset on G1
        /// and G2).
        /// </summary>
        /// <param name="set">the BitArray</param>
        /// <returns>the RMap list</returns>
        public IReadOnlyList <RMap> BitSetToRMap(BitArray set)
        {
            var rMapList = new List <RMap>();

            for (int x = BitArrays.NextSetBit(set, 0); x >= 0; x = BitArrays.NextSetBit(set, x + 1))
            {
                RNode xNode = graph[x];
                rMapList.Add(xNode.RMap);
            }
            return(rMapList);
        }
Esempio n. 3
0
        /// <summary>
        ///  Projects a RGraph bitset on the source graph G2.
        /// </summary>
        /// <param name="set">RGraph BitArray to project</param>
        /// <returns>The associate BitArray in G2</returns>
        public BitArray ProjectG2(BitArray set)
        {
            BitArray projection = new BitArray(SecondGraphSize);
            RNode    xNode      = null;

            for (int x = BitArrays.NextSetBit(set, 0); x >= 0; x = BitArrays.NextSetBit(set, x + 1))
            {
                xNode = graph[x];
                projection.Set(xNode.RMap.Id2, true);
            }
            return(projection);
        }
Esempio n. 4
0
 /// <summary>
 ///  Adds a new node to the RGraph.
 /// </summary>
 /// <param name="newNode">The node to add to the graph</param>
 public void AddNode(RNode newNode)
 {
     graph.Add(newNode);
     BitArrays.EnsureCapacity(graphBitSet, graph.Count);
     graphBitSet.Set(graph.Count - 1, true);
 }