internal override void GetGraphHelper(Graph g, SppfNodeNode myNode, HashSet<InteriorNode> visited) { if (visited.Contains(this)) { return; } visited.Add(this); // foreach (var family in Families) { for (int i = 0; i < Families.Count; i++) { var family = Families[i]; Production singletonProduction = null; INode prevNode; if (Families.Count == 1) { prevNode = myNode; singletonProduction = Families[0].Production; } else { prevNode = new FamilyNode(family, myNode.Node.Id + "-" + i, myNode.Rank + 1); // g.AddEdge(myNode, prevNode, family.Production); g.AddEdge(myNode, prevNode); } foreach (var child in family.Members) { var childNode = new SppfNodeNode(child, prevNode.Rank + 1); // var childNode = g.GetNode(child, prevNode.Rank + 1); // g.AddEdge(prevNode, childNode, singletonProduction); g.AddEdge(prevNode, childNode); child.GetGraphHelper(g, childNode, visited); } } }
internal void GetGraphHelper(SppfNode node, SppfNodeNode myNode) { if (_visited.Contains(node)) { return; } _visited.Add(node); var i = 0; foreach (var family in node.Families) { // for (int i = 0; i < Families.Count; i++) { // var family = Families[i]; Production lowerProduction = null; IGraphNode prevNode; if (node.Families.Count() == 1) { prevNode = myNode; lowerProduction = node.Families.Single().Production; } else { var id = GetOrSetId(node); prevNode = new FamilyNode(family, id + "-" + i, myNode.Rank + 1); _g.AddEdge(myNode, prevNode, family.Production); //g.AddEdge(myNode, prevNode); } prevNode.TheFamily = family; foreach (var child in family.Members) { var id = GetOrSetId(child); var childNode = new SppfNodeNode(child, prevNode.Rank + 1, id); // var childNode = g.GetNode(child, prevNode.Rank + 1); // g.AddEdge(prevNode, childNode, singletonProduction); // g.AddEdge(prevNode, childNode, singletonProduction); _g.AddEdge(prevNode, childNode, lowerProduction); GetGraphHelper(child, childNode); } i++; } }