output 0-1 matrix by default
This commit is contained in:
parent
fd26e49734
commit
552978478a
|
@ -38,7 +38,14 @@ func NewDOTDirectedGraph(weightAttr string) *DOTDirectedGraph {
|
|||
|
||||
// NewLine returns a DOT-aware weighted line.
|
||||
func (g *DOTDirectedGraph) NewLine(from, to graph.Node) graph.Line {
|
||||
e := g.DirectedGraph.NewWeightedLine(from, to, math.NaN()).(multi.WeightedLine)
|
||||
var defaultWeight float64
|
||||
if g.WeightAttribute == "" {
|
||||
defaultWeight = 1
|
||||
} else {
|
||||
defaultWeight = math.NaN()
|
||||
}
|
||||
|
||||
e := g.DirectedGraph.NewWeightedLine(from, to, defaultWeight).(multi.WeightedLine)
|
||||
return &weightedLine{WeightedLine: e, weightAttribute: g.WeightAttribute}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
package dot
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
"gonum.org/v1/gonum/graph"
|
||||
|
@ -57,8 +56,6 @@ func (e *weightedLine) SetAttribute(attr encoding.Attribute) error {
|
|||
switch attr.Key {
|
||||
case e.weightAttribute:
|
||||
e.W, err = strconv.ParseFloat(attr.Value, 64)
|
||||
default:
|
||||
err = errors.New("unknown key:" + attr.Key)
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
@ -150,7 +150,7 @@ func init() {
|
|||
|
||||
rootCmd.Flags().BoolVar(&oneline, "oneline", false, "output on one line")
|
||||
|
||||
rootCmd.Flags().StringVar(&weightAttr, "weight-attr", "len", "edge attribute to use as weight")
|
||||
rootCmd.Flags().StringVar(&weightAttr, "weight-attr", "", "edge attribute to use as weight")
|
||||
|
||||
rootCmd.Flags().StringSliceVarP(&nodeOrder, "order", "o", nil, "order of nodes in rows/columns of output")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue