remove AbsorbingNodes method
This commit is contained in:
parent
35132702d6
commit
06048d8a2a
|
@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
package graph
|
||||
|
||||
import (
|
||||
"gonum.org/v1/gonum/graph"
|
||||
"gonum.org/v1/gonum/graph/multi"
|
||||
"gonum.org/v1/gonum/graph/simple"
|
||||
"gonum.org/v1/gonum/mat"
|
||||
|
@ -34,27 +33,6 @@ func NewDirectedGraph() *DirectedGraph {
|
|||
return &DirectedGraph{WeightedDirectedGraph: multi.NewWeightedDirectedGraph()}
|
||||
}
|
||||
|
||||
// AbsorbingNodes returns all the nodes in the Markov chain identified as
|
||||
// absorbing nodes.
|
||||
func (g *DirectedGraph) AbsorbingNodes() []graph.Node {
|
||||
absorbingNodes := make([]graph.Node, 0)
|
||||
for nodes := g.Nodes(); nodes.Next(); {
|
||||
u := nodes.Node()
|
||||
successors := g.From(u.ID())
|
||||
if successors.Len() != 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
successors.Next()
|
||||
v := successors.Node()
|
||||
if u == v {
|
||||
absorbingNodes = append(absorbingNodes, u)
|
||||
}
|
||||
}
|
||||
|
||||
return absorbingNodes
|
||||
}
|
||||
|
||||
// AdjacencyMatrix returns the graph's adjacency matrix.
|
||||
func (g *DirectedGraph) AdjacencyMatrix() *mat.Dense {
|
||||
adj := simple.NewDirectedMatrix(g.Nodes().Len(), 0, 0, 0)
|
||||
|
|
Loading…
Reference in New Issue