public void GraphMatchBruteForce1() { Dictionary <INode, INode> empty = new Dictionary <INode, INode>(); INode a = this._factory.CreateBlankNode("a"); INode b1 = this._factory.CreateBlankNode("b1"); INode b2 = this._factory.CreateBlankNode("b2"); //For this test we have a single blank node with two possible mappings Dictionary <INode, List <INode> > possibles = new Dictionary <INode, List <INode> >(); possibles.Add(a, new List <INode> { b1, b2 }); List <Dictionary <INode, INode> > generated = GraphMatcher.GenerateMappings(empty, possibles).ToList(); this.PrintMappings(generated); Assert.AreEqual(2, generated.Count); Assert.IsTrue(generated.All(m => m.ContainsKey(a))); Assert.IsFalse(generated.All(m => m[a].Equals(b1))); }
public void GraphMatchBruteForce3() { Dictionary <INode, INode> empty = new Dictionary <INode, INode>(); INode a1 = this._factory.CreateBlankNode("a1"); INode a2 = this._factory.CreateBlankNode("a2"); INode b1 = this._factory.CreateBlankNode("b1"); INode b2 = this._factory.CreateBlankNode("b2"); //For this test we have a two blank nodes where the first has a single mapping and the second two possible mappings Dictionary <INode, List <INode> > possibles = new Dictionary <INode, List <INode> >(); possibles.Add(a1, new List <INode> { b1 }); possibles.Add(a2, new List <INode> { b1, b2 }); List <Dictionary <INode, INode> > generated = GraphMatcher.GenerateMappings(empty, possibles).ToList(); this.PrintMappings(generated); Assert.AreEqual(2, generated.Count); Assert.IsTrue(generated.All(m => m.ContainsKey(a1))); }