change type names

This commit is contained in:
filifa 2025-05-08 23:57:28 -04:00
parent 90c5547710
commit 5bd49f2037
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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.

View File

@ -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