Boost Users :
Subject: Re: [Boost-users] [BGL] Is it possible to control algorithm's behavior by visitor?
From: Li Ning (Ning.c.Li_at_[hidden])
Date: 2009-05-22 23:09:31
Jeremiah Willcock wrote:
>> Sorry. I should give a example. Note that edge has no uni or bi type. All
>> edge is bi, az capacity for data from source to target, za capacity for
>> from target to source. It is different from un-direct graph edge: If edge
>> has capacity 5 and I go through it from source to target with 3 capacity
>> & 2
>> capacity in reverse. This edge will be dead. But in telecom model, this
>> still can accommodate 2 capacity from source to target and 3 capacity in
>> || ||
>> Above is a graph. line 1 connect A & B, line 2 connect B & C. line 1 has
>> cost 1, capacity 5. line 2 has cost 2, capacity 10.
>> Now, I want to send data from A to B at bandwidth 5, so I establish a uni
>> connection c1(it is uni because all I want is send, no receive). from A
>> B. This c1 connection direction is from A to B and line 1 direction is
>> A to B, they are identical. Notice that line has 2 separated capacity,
>> means: if a line has capacity x, this line can transmit data from source
>> destination at bandwidth x AND from destination to source at bandwidth x.
>> we say az direction capacity of line 1 was used by c1.
>> After established c1, we can establish a c2 from B to A at bandwidth 5.
>> c2 will use za capacity of line 1.
>> More step, we assume line 2's source is vertex C & destination vertex is
>> Then we can establish a uni connection c3 from A to C(forget c1 & c2 at
>> moment), this c3 will use line 1's az capacity and line 2's za
>> direction contradict with line 2).
>> Above is the rule of capacity usage. Cost is same as weight, the weight
>> edge. A shortest path is the lowest cost path. This is same as Graph
>> Also, we can establish a connection used to BOTH send & receive data
>> two vertex. This connection is bi-connection. bi-connection will use a
>> line's az & za capaciy together. It requires both az & za must belong to
>> same line. That means bi-connection's send data path & receive data path
>> MUST have same edge sequence.
>> Now clear all connections and edge properties in this graph. Let
>> line(ab): cost 1, capacity 5
>> line(bc): cost 10, capacity 5
>> line(bd): cost 1, capacity 5
>> line(de): cost 1, capacity 5
>> line(ec): cost 1, capacity 5
>> line(xy) means edge's source vertex is x, target vertex is y.
>> A bi-connection c1 with bandwidth 4 from A to C is: a---b---d----e----c,
>> cost 4. smaller than a----b----c, cost 11.
>> After c1, can we establish a uni connection c2 from C to A with bandwidth
>> After c2, can we establish a uni connection c3 from B to A? No, because
>> line(ab)'s za capacity is full. They are 4(used by c1) + 1(used by c2) =
>> Now, the capacity of line(ab) is: only az capacity has 1 available.
>> So bi-connection actually a path in un-directed graph. uni-connection is
>> path in directed graph. Of course a path can not contain any cycle, that
>> If we only routing uni-connection, then it is a classical finding path
>> problem in directed graph.
>> If we only routing bi-connection, then it is a classical finding path
>> problem in un-directed graph.
>> What if sometimes we need to routing uni-connection, sometimes we need to
>> routing bi-connection in a single graph?
>> The only solution I can figure out is reduce them to a un-directed graph
>> with complex decision policy.
>> However I found BGL is hard to deal with these policy.
>> If you has problem about my explain, contact me.
> Are you sure you don't want a max-flow algorithm instead? Some algorithm
> that finds optimal flows with costs for edges? Are you trying to find the
> shortest path by adding up the costs of the edges? If you are trying to
> find the shortest path using only edges with a certain capacity left, you
> can ignore directions; using both directions of an undirected edge would
> create a cycle in the output path, which is not possible with only
> positive edge weights.
> You might want to look through
> to see if any of those problems match what you are trying to do. I am not
> completely sure whether you really want a shortest-path algorithm or
> something else.
> -- Jeremiah Willcock
> Boost-users mailing list
Yes, it is a shortest path problem with complex capacity usage. The path I
need to find is lowest cost path. So max-flow won't help because it gives
you a distribution rather than a path.
-- View this message in context: http://www.nabble.com/-BGL--Is-it-possible-to-control-algorithm%27s-behavior-by-visitor--tp23648334p23680978.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net