Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nx::Class create EdgeGraphPrinted -superclass EdgeList_Graph {
- :public method dot_print {} {
- if {${directed}} {
- append collections "digraph {\n"
- if {{$weighed}} {
- foreach edge ${:edges} {
- append collections "\t"
- append collections "[string trim [$edge cget -a] "::nsf::__#"] -> [string trim [$edge cget -b] "::nsf::__#"]"
- append collections "\t"
- append collections "\n"
- }
- } else {
- foreach edge ${:edges} {
- append collections "\t"
- append collections "[string trim [$edge cget -a] "::nsf::__#"] -> [string trim [$edge cget -b] "::nsf::__#"]"
- append collections "\t"
- append collections "\n"
- }
- }
- } else {
- append collections "graph {\n"
- if {{$weighed}} {
- foreach edge ${:edges} {
- append collections "\t"
- append collections "[string trim [$edge cget -a] "::nsf::__#"] -- [string trim [$edge cget -b] "::nsf::__#"]"
- append collections "\t"
- append collections "\n"
- }
- } else {
- foreach edge ${:edges} {
- append collections "\t"
- append collections "[string trim [$edge cget -a] "::nsf::__#"] -- [string trim [$edge cget -b] "::nsf::__#"]"
- append collections "\t"
- append collections "\n"
- }
- }
- }
- append collections "\}"
- puts $collections
- return $collections
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement