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
|
// DirectedGraph embeds a multi.WeightedDirectedGraph (as opposed to
|
||||||
// simple.WeightedDirectedGraph) to handle self loops.
|
// simple.WeightedDirectedGraph) to handle self loops.
|
||||||
type DirectedGraph struct {
|
type WeightedDirectedGraph struct {
|
||||||
*multi.WeightedDirectedGraph
|
*multi.WeightedDirectedGraph
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDirectedGraph returns a graph with no nodes or edges.
|
// NewDirectedGraph returns a graph with no nodes or edges.
|
||||||
func NewDirectedGraph() *DirectedGraph {
|
func NewWeightedDirectedGraph() *WeightedDirectedGraph {
|
||||||
return &DirectedGraph{WeightedDirectedGraph: multi.NewWeightedDirectedGraph()}
|
return &WeightedDirectedGraph{WeightedDirectedGraph: multi.NewWeightedDirectedGraph()}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AdjacencyMatrix returns the graph's adjacency matrix.
|
// 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)
|
adj := simple.NewDirectedMatrix(g.Nodes().Len(), 0, 0, 0)
|
||||||
matrix := toAdjMatrix(g, adj)
|
matrix := toAdjMatrix(g, adj)
|
||||||
return matrix
|
return matrix
|
||||||
|
|
|
@ -33,11 +33,11 @@ type DOTWeightedGraph struct {
|
||||||
|
|
||||||
// NewDOTDirectedGraph returns a graph with no nodes or edges.
|
// NewDOTDirectedGraph returns a graph with no nodes or edges.
|
||||||
func NewDOTDirectedGraph(weightAttr string) DOTWeightedGraph {
|
func NewDOTDirectedGraph(weightAttr string) DOTWeightedGraph {
|
||||||
return DOTWeightedGraph{WeightedGraph: igraph.NewDirectedGraph(), WeightAttribute: weightAttr}
|
return DOTWeightedGraph{WeightedGraph: igraph.NewWeightedDirectedGraph(), WeightAttribute: weightAttr}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDOTUndirectedGraph(weightAttr string) DOTWeightedGraph {
|
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.
|
// NewLine returns a DOT-aware weighted line.
|
||||||
|
|
|
@ -24,17 +24,17 @@ import (
|
||||||
|
|
||||||
// UndirectedGraph embeds a multi.WeightedUndirectedGraph (as opposed to
|
// UndirectedGraph embeds a multi.WeightedUndirectedGraph (as opposed to
|
||||||
// simple.WeightedUndirectedGraph) to handle self loops.
|
// simple.WeightedUndirectedGraph) to handle self loops.
|
||||||
type UndirectedGraph struct {
|
type WeightedUndirectedGraph struct {
|
||||||
*multi.WeightedUndirectedGraph
|
*multi.WeightedUndirectedGraph
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUndirectedGraph returns a graph with no nodes or edges.
|
// NewUndirectedGraph returns a graph with no nodes or edges.
|
||||||
func NewUndirectedGraph() *UndirectedGraph {
|
func NewWeightedUndirectedGraph() *WeightedUndirectedGraph {
|
||||||
return &UndirectedGraph{WeightedUndirectedGraph: multi.NewWeightedUndirectedGraph()}
|
return &WeightedUndirectedGraph{WeightedUndirectedGraph: multi.NewWeightedUndirectedGraph()}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AdjacencyMatrix returns the graph's adjacency matrix.
|
// 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)
|
adj := simple.NewUndirectedMatrix(g.Nodes().Len(), 0, 0, 0)
|
||||||
matrix := toAdjMatrix(g, adj)
|
matrix := toAdjMatrix(g, adj)
|
||||||
return matrix
|
return matrix
|
||||||
|
|
Loading…
Reference in New Issue