From 5bd49f203786fb6c5ae77aa0420dfdb689025a1d Mon Sep 17 00:00:00 2001 From: filifa Date: Thu, 8 May 2025 23:57:28 -0400 Subject: [PATCH] change type names --- cmd/internal/graph/directed.go | 8 ++++---- cmd/internal/graph/dot/graph.go | 4 ++-- cmd/internal/graph/undirected.go | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/internal/graph/directed.go b/cmd/internal/graph/directed.go index 8a71b06..702f593 100644 --- a/cmd/internal/graph/directed.go +++ b/cmd/internal/graph/directed.go @@ -24,17 +24,17 @@ import ( // DirectedGraph embeds a multi.WeightedDirectedGraph (as opposed to // simple.WeightedDirectedGraph) to handle self loops. -type DirectedGraph struct { +type WeightedDirectedGraph struct { *multi.WeightedDirectedGraph } // NewDirectedGraph returns a graph with no nodes or edges. -func NewDirectedGraph() *DirectedGraph { - return &DirectedGraph{WeightedDirectedGraph: multi.NewWeightedDirectedGraph()} +func NewWeightedDirectedGraph() *WeightedDirectedGraph { + return &WeightedDirectedGraph{WeightedDirectedGraph: multi.NewWeightedDirectedGraph()} } // AdjacencyMatrix returns the graph's adjacency matrix. -func (g *DirectedGraph) AdjacencyMatrix() *mat.Dense { +func (g *WeightedDirectedGraph) AdjacencyMatrix() *mat.Dense { adj := simple.NewDirectedMatrix(g.Nodes().Len(), 0, 0, 0) matrix := toAdjMatrix(g, adj) return matrix diff --git a/cmd/internal/graph/dot/graph.go b/cmd/internal/graph/dot/graph.go index 0a55aaa..952f79f 100644 --- a/cmd/internal/graph/dot/graph.go +++ b/cmd/internal/graph/dot/graph.go @@ -33,11 +33,11 @@ type DOTWeightedGraph struct { // NewDOTDirectedGraph returns a graph with no nodes or edges. func NewDOTDirectedGraph(weightAttr string) DOTWeightedGraph { - return DOTWeightedGraph{WeightedGraph: igraph.NewDirectedGraph(), WeightAttribute: weightAttr} + return DOTWeightedGraph{WeightedGraph: igraph.NewWeightedDirectedGraph(), WeightAttribute: weightAttr} } func NewDOTUndirectedGraph(weightAttr string) DOTWeightedGraph { - return DOTWeightedGraph{WeightedGraph: igraph.NewUndirectedGraph(), WeightAttribute: weightAttr} + return DOTWeightedGraph{WeightedGraph: igraph.NewWeightedUndirectedGraph(), WeightAttribute: weightAttr} } // NewLine returns a DOT-aware weighted line. diff --git a/cmd/internal/graph/undirected.go b/cmd/internal/graph/undirected.go index a4ef291..faf7b60 100644 --- a/cmd/internal/graph/undirected.go +++ b/cmd/internal/graph/undirected.go @@ -24,17 +24,17 @@ import ( // UndirectedGraph embeds a multi.WeightedUndirectedGraph (as opposed to // simple.WeightedUndirectedGraph) to handle self loops. -type UndirectedGraph struct { +type WeightedUndirectedGraph struct { *multi.WeightedUndirectedGraph } // NewUndirectedGraph returns a graph with no nodes or edges. -func NewUndirectedGraph() *UndirectedGraph { - return &UndirectedGraph{WeightedUndirectedGraph: multi.NewWeightedUndirectedGraph()} +func NewWeightedUndirectedGraph() *WeightedUndirectedGraph { + return &WeightedUndirectedGraph{WeightedUndirectedGraph: multi.NewWeightedUndirectedGraph()} } // AdjacencyMatrix returns the graph's adjacency matrix. -func (g *UndirectedGraph) AdjacencyMatrix() *mat.Dense { +func (g *WeightedUndirectedGraph) AdjacencyMatrix() *mat.Dense { adj := simple.NewUndirectedMatrix(g.Nodes().Len(), 0, 0, 0) matrix := toAdjMatrix(g, adj) return matrix