3
$\begingroup$

We can label the EdgeWeight into edge like following

Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1}, EdgeWeight -> Range@3, 
 EdgeLabels -> "EdgeWeight"]

enter image description here

But how to label the EdgeCapacity , EdgeCost and VertexCapacity into graph with an ease solution?

$\endgroup$
  • 1
    $\begingroup$ Title and body do not match. $\endgroup$ – J. M. will be back soon Jun 2 '16 at 18:06
  • $\begingroup$ @J.M. Sorry.I make a mistake. $\endgroup$ – yode Jun 2 '16 at 18:09
  • $\begingroup$ Same problem to me. I simply do not understand why this does not work. I a flow graph EdgeCapacitywould be appropriate. $\endgroup$ – mgamer Oct 27 '16 at 3:59
  • $\begingroup$ related q/a: Label graphs based on custom properties $\endgroup$ – kglr Apr 18 '17 at 19:54
2
$\begingroup$

Suppose we have a graph with EdgeCapacity

graph = Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1}, EdgeCapacity -> Range@3];

we have a in-build method

Graph[graph, 
 EdgeLabels -> 
  Thread[EdgeList[
     graph] -> (PropertyValue[{graph, #}, EdgeCapacity] & /@ 
      EdgeList[graph])]]

Mathematica graphics


And there is a coming method based on IGraph/M

IGEdgeMap[# &, EdgeLabels -> IGEdgeProp[EdgeCapacity], graph]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.