private void CreateRootGraphInternal(CelestialObjectType type, ObjectTypesGraph graph) { //ObjectTypeVertex parent = new ObjectTypeVertex(string.Format("{0} ({1})", type.Description, type.ShortCode)); ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type, _previousRoot); graph.AddVertex(parent); if (type.Subtypes.Count > 0) { foreach (CelestialObjectType subtype in type.Subtypes) { ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent); graph.AddVertex(child); graph.AddEdge(new ObjectTypeEdge(parent, child)); //CreateGraphInternal(subtype, graph); } } }
//private void CreateRootGraphInternal(CelestialObjectType type, ObjectTypesGraph graph, ObjectTypeVertex parentVertex) //{ // //ObjectTypeVertex parent = new ObjectTypeVertex(string.Format("{0} ({1})", type.Description, type.ShortCode)); // ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type, parentVertex); // graph.AddVertex(parent); // if (type.Subtypes.Count > 0) // { // foreach (CelestialObjectType subtype in type.Subtypes) // { // ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent); // graph.AddVertex(child); // graph.AddEdge(new ObjectTypeEdge(parent, child)); // //CreateGraphInternal(subtype, graph); // } // } //} private void CreateGraphInternal(CelestialObjectType type, ObjectTypesGraph graph) { ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type); graph.AddVertex(parent); if (type.Subtypes.Count > 0) { foreach (CelestialObjectType subtype in type.Subtypes) { ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent); graph.AddVertex(child); graph.AddEdge(new ObjectTypeEdge(parent, child)); CreateGraphInternal(subtype, graph); } } }