private static IBidirectionalGraph <HierarchicalGraphVertex, HierarchicalGraphEdge> BuildHierarchicalGraph(IUndirectedGraph <Cluster <Variety>, ClusterEdge <Variety> > tree) { var graph = new BidirectionalGraph <HierarchicalGraphVertex, HierarchicalGraphEdge>(); var root = new HierarchicalGraphVertex(0); graph.AddVertex(root); GenerateHierarchicalVertices(graph, root, tree, null, tree.GetCenter()); return(graph); }
private static IBidirectionalGraph <HierarchicalGraphVertex, HierarchicalGraphEdge> BuildHierarchicalGraph(IUndirectedGraph <Cluster <Variety>, ClusterEdge <Variety> > tree) { var graph = new BidirectionalGraph <HierarchicalGraphVertex, HierarchicalGraphEdge>(); var root = new HierarchicalGraphVertex(0); graph.AddVertex(root); if (tree.VertexCount > 2) { GenerateHierarchicalVertices(graph, root, tree, null, tree.GetCenter()); } else { foreach (Cluster <Variety> cluster in tree.Vertices) { GenerateHierarchicalVertices(graph, root, tree, null, cluster); } } return(graph); }
private static IBidirectionalGraph<HierarchicalGraphVertex, HierarchicalGraphEdge> BuildHierarchicalGraph(IUndirectedGraph<Cluster<Variety>, ClusterEdge<Variety>> tree) { var graph = new BidirectionalGraph<HierarchicalGraphVertex, HierarchicalGraphEdge>(); var root = new HierarchicalGraphVertex(0); graph.AddVertex(root); GenerateHierarchicalVertices(graph, root, tree, null, tree.GetCenter()); return graph; }