diff --git a/cmd/internal/markov/absorbing.go b/cmd/internal/markov/absorbing.go
index 4201979..d79bb99 100644
--- a/cmd/internal/markov/absorbing.go
+++ b/cmd/internal/markov/absorbing.go
@@ -17,8 +17,6 @@ along with this program. If not, see .
package markov
import (
- "math"
-
"gonum.org/v1/gonum/graph"
"gonum.org/v1/gonum/graph/multi"
"gonum.org/v1/gonum/graph/simple"
@@ -139,19 +137,3 @@ func (g *AbsorbingMarkovChain) AdjacencyMatrix() *mat.Dense {
return a
}
-
-// NewLine returns a DOT-aware weighted line.
-func (g *AbsorbingMarkovChain) NewLine(from, to graph.Node) graph.Line {
- e := g.WeightedDirectedGraph.NewWeightedLine(from, to, math.NaN()).(multi.WeightedLine)
- return &weightedLine{WeightedLine: e}
-}
-
-// NewNode returns a DOT-aware Node.
-func (g *AbsorbingMarkovChain) NewNode() graph.Node {
- return &Node{Node: g.WeightedDirectedGraph.NewNode()}
-}
-
-// SetLine adds a DOT-aware weighted line to the Markov chain.
-func (g *AbsorbingMarkovChain) SetLine(e graph.Line) {
- g.WeightedDirectedGraph.SetWeightedLine(e.(*weightedLine))
-}
diff --git a/cmd/internal/markov/dot/markov.go b/cmd/internal/markov/dot/markov.go
new file mode 100644
index 0000000..c00d090
--- /dev/null
+++ b/cmd/internal/markov/dot/markov.go
@@ -0,0 +1,53 @@
+/*
+Copyright © 2025 filifa
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+package dot
+
+import (
+ "math"
+
+ "scm.dairydemon.net/filifa/dptdist/cmd/internal/markov"
+
+ "gonum.org/v1/gonum/graph"
+ "gonum.org/v1/gonum/graph/multi"
+)
+
+// DOTMarkovChain is a graph representing an absorbing Markov chain.
+type DOTMarkovChain struct {
+ *markov.AbsorbingMarkovChain
+}
+
+// NewDOTMarkovChain returns an absorbing Markov chain with no nodes or
+// edges.
+func NewDOTMarkovChain() *DOTMarkovChain {
+ return &DOTMarkovChain{AbsorbingMarkovChain: markov.NewAbsorbingMarkovChain()}
+}
+
+// NewLine returns a DOT-aware weighted line.
+func (g *DOTMarkovChain) NewLine(from, to graph.Node) graph.Line {
+ e := g.AbsorbingMarkovChain.NewWeightedLine(from, to, math.NaN()).(multi.WeightedLine)
+ return &weightedLine{WeightedLine: e}
+}
+
+// NewNode returns a DOT-aware Node.
+func (g *DOTMarkovChain) NewNode() graph.Node {
+ return &Node{Node: g.AbsorbingMarkovChain.NewNode()}
+}
+
+// SetLine adds a DOT-aware weighted line to the Markov chain.
+func (g *DOTMarkovChain) SetLine(e graph.Line) {
+ g.AbsorbingMarkovChain.SetWeightedLine(e.(*weightedLine))
+}
diff --git a/cmd/internal/markov/nodes_edges.go b/cmd/internal/markov/dot/nodes_edges.go
similarity index 99%
rename from cmd/internal/markov/nodes_edges.go
rename to cmd/internal/markov/dot/nodes_edges.go
index 5f7e9d7..fc3c7b5 100644
--- a/cmd/internal/markov/nodes_edges.go
+++ b/cmd/internal/markov/dot/nodes_edges.go
@@ -14,7 +14,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-package markov
+package dot
import (
"errors"
diff --git a/cmd/root.go b/cmd/root.go
index d6360df..d44c124 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -21,7 +21,7 @@ import (
"fmt"
"os"
- "scm.dairydemon.net/filifa/dptdist/cmd/internal/markov"
+ markovDOT "scm.dairydemon.net/filifa/dptdist/cmd/internal/markov/dot"
"github.com/spf13/cobra"
"gonum.org/v1/gonum/graph/encoding/dot"
@@ -58,7 +58,7 @@ func parse(cmd *cobra.Command, args []string) {
panic(err)
}
- graph := markov.NewAbsorbingMarkovChain()
+ graph := markovDOT.NewDOTMarkovChain()
err = dot.UnmarshalMulti(data, graph)
if err != nil {
panic(err)
@@ -80,7 +80,7 @@ func parse(cmd *cobra.Command, args []string) {
outputMatrix(matrix)
}
-func orderedAdjMatrix(g *markov.AbsorbingMarkovChain) (*mat.Dense, error) {
+func orderedAdjMatrix(g *markovDOT.DOTMarkovChain) (*mat.Dense, error) {
matrix := g.AdjacencyMatrix()
if len(nodeOrder) == 0 {
return matrix, nil
@@ -94,7 +94,7 @@ func orderedAdjMatrix(g *markov.AbsorbingMarkovChain) (*mat.Dense, error) {
nodes := g.Nodes()
newOrder := make([]int, nodes.Len())
for nodes.Next() {
- node := nodes.Node().(*markov.Node)
+ node := nodes.Node().(*markovDOT.Node)
id := node.DOTID()
var ok bool