
destroy .about
toplevel .about
wm title .about "Problem Statistics"
wm resizable .about 0 0

global ThisGraph goblinMethGeometry

frame .about.frame1
frame .about.frame2
frame .about.frame3
pack .about.frame1 .about.frame2 .about.frame3 \
    -side top -fill x -padx 10m -pady 5m

    label .about.frame1.label -text "Problem Characteristics:" -anchor w

    if {[$ThisGraph is sparse]} {
        if {[$ThisGraph is undirected]} {
            if {[$ThisGraph is bipartite]} {
                set type "Bipartite Incidence Structure"
            } else {
                set type "Undirected Incidence Structure"
            }
        } else {
            if {[$ThisGraph is directed]} {
                set type "Directed Incidence Structure"
            } else {
                set type "Mixed Incidence Structure"
            }
        }
    } else {
        if {[$ThisGraph is undirected]} {
            if {[$ThisGraph is bipartite]} {
                set type "Complete Bipartite Graph"
            } else {
                set type "Complete Undirected Graph"
            }
        } else {
            set type "Complete Directed Graph"
        }
    }
    
    if {$goblinMethGeometry==0} {
        set geometry "Explicit Length Labels"
    } else {
        set geometry "2-Dimensional"
        if {$goblinMethGeometry==1} {set geometry "$geometry Manhattan-Metrics"}
        if {$goblinMethGeometry==2} {set geometry "$geometry Euclidean"}
        if {$goblinMethGeometry==3} {set geometry "$geometry Maximum Metrics"}
    }
    
    label .about.frame1.type -text "  $type" -anchor w
    label .about.frame1.geometry -text "  $geometry" -anchor w

    pack .about.frame1.label .about.frame1.type .about.frame1.geometry -fill x



    label .about.frame2.label -text "Problem Dimensions:" -anchor w

    label .about.frame2.nnodes -text "  Number of Nodes: [$ThisGraph #nodes]" -anchor w
    label .about.frame2.narcs -text "  Number of Arcs: [$ThisGraph #arcs]" -anchor w

    if {![$ThisGraph constant ucap]} {
        set maxUCap "Maximum Upper Bound: [$ThisGraph max ucap]"
    } else {
        set maxUCap "Constant Upper Bounds: [$ThisGraph max ucap]"
    }
    label .about.frame2.maxucap -text "  $maxUCap" -anchor w

    if {![$ThisGraph constant lcap]} {
        set maxLCap "Maximum Lower Bound: [$ThisGraph max lcap]"
    } else {
        set maxLCap "Constant Lower Bounds: [$ThisGraph max lcap]"
    }
    label .about.frame2.maxlcap -text "  $maxLCap" -anchor w
    
    pack .about.frame2.label .about.frame2.nnodes .about.frame2.narcs \
        .about.frame2.maxucap .about.frame2.maxlcap -fill x

    if {![$ThisGraph constant demand]} {
        set nDemands 0
        set nSupplies 0
        for {set v 0} {$v<[$ThisGraph #nodes]} {incr v} {
            if {[$ThisGraph node $v demand]>0} {incr nDemands}
            if {[$ThisGraph node $v demand]<0} {incr nSupplies}
        }
    
        if {$nDemands>0} {
            label .about.frame2.ndemands -text "  Demand Nodes: $nDemands" -anchor w
            pack .about.frame2.ndemands -fill x
        }
    
        if {$nSupplies>0} {
            label .about.frame2.nsupplies -text "  Supply Nodes: $nSupplies" -anchor w
            pack .about.frame2.nsupplies -fill x
        }
    
        set maxDemand "Maximum Node Demand: [$ThisGraph max demand]"
    } else {
        set maxDemand "Constant Node Demands: [$ThisGraph max demand]"
    }
    label .about.frame2.maxdemand -text "  $maxDemand" -anchor w
    pack .about.frame2.maxdemand -fill x

    if {![$ThisGraph constant length]} {
        set nNegative 0
        for {set a 0} {$a<[$ThisGraph #arcs]} {incr a} {
            if {[$ThisGraph arc [expr 2*$a] length]<0} {incr nNegative}
        }
    
        if {$nNegative>0} {
            label .about.frame2.nnegative -text "  Negative Length Arcs: $nNegative" -anchor w
            pack .about.frame2.nnegative -fill x
        }
    
        set maxLength "Maximum Arc Length: [$ThisGraph max length]"
    } else {
        set maxLength "Constant Arc Lengths: [$ThisGraph max length]"
    }
    label .about.frame2.maxlength -text "  $maxLength" -anchor w

    label .about.frame2.box -anchor w \
        -text "  Bounding Box: ([$ThisGraph max cx],[$ThisGraph max cy])"
    pack .about.frame2.maxlength .about.frame2.box -fill x
    

    label .about.frame3.label -text "Solutions:" -anchor w

    label .about.frame3.card \
        -text "  Subgraph Cardinality: [$ThisGraph cardinality]" -anchor w
    label .about.frame3.weight \
        -text "  Subgraph Weight: [$ThisGraph weight]" -anchor w
    label .about.frame3.length \
        -text "  Path/Tree Length: [$ThisGraph length]" -anchor w
    pack .about.frame3.label .about.frame3.card .about.frame3.weight \
        .about.frame3.length -fill x
    
frame .about.buttons
    button .about.buttons.done -text "Done" -command { \
        destroy .about
    }
    
    pack .about.buttons.done -side left -fill x -padx 3m
     
pack .about.buttons -padx 3m -pady 3m -side bottom

