Modify

Opened 16 years ago

Closed 16 years ago

#8 closed Bugs (Works For Me)

prop in undirected graph + out_edges

Reported by: nobody Owned by: jsiek
Milestone: Component: graph
Version: None Severity:
Keywords: Cc:

Description

The following code ( only part of it ) where I tried 
to set the property of an edge obtained from an out 
edge_iterator:

enum edge_state_t { not_visited, visited };

typedef boost::property<
  boost::edge_name_t,
  edge_state_t
> edge_property;
typedef boost::adjacency_list<
  boost::vecS,
  boost::vecS,
  boost::undirectedS,
  boost::no_property,
  edge_property,
  boost::no_property
> graph_type;

graph_type g;

boost::property_map<graph_type,boost::edge_name_t>::typ
e edge_state = get(boost::edge_name_t(),g);

out_edge_iterator e, eend;
boost::tie(e, eend) = out_edges(tmpv,g);
for ( ; e != eend; ++e )
  if ( edge_state[*e] == not_visited ) {
    // Version 1
    edge_state[*e] == visited;
    // Version 2
    edge_state[edge(source(*e,g),targe(*e,g),g).first] 
= visited;
    tmpv = target(*e,g);
  }

Version 2 works, while Version 1 does not ( the 
property is not assigned ). I'm not 100% sure that 
this should work, but as far as I know the 
documentation Version 1 should work as well. 

The out_edge_iterator is an ordered pair as the target 
vertex is fixed. The "normal" edge is undirected, so 
Version 1 seems only to work, when by luck, the 
ordered pair corresponds somhow to the unordered one. 

Attachments (0)

Change History (2)

comment:1 Changed 16 years ago by nobody

Logged In: NO 

Dear Jeremy,

I overlooked the == in Version 1.

Please forget about the bug....

comment:2 Changed 16 years ago by jsiek

Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jsiek.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.