change type names
This commit is contained in:
parent
90c5547710
commit
5bd49f2037
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue