COIN-OR::LEMON - Graph Library

Opened 9 years ago

Last modified 8 years ago

#189 new enhancement

Add the functionality of ItemSetTraits to the graphs

Reported by: kpeter Owned by: deba
Priority: major Milestone:
Component: core Version: hg main
Keywords: Cc:
Revision id:

Description

Maybe we could introduce the functionality of ItemSetTraits to the graph concepts and to the adaptors in order to have the followings for all graph types.

  • Graph::Map<T, Value>
  • Graph::It<T> or Graph::ItemIt<T>

Where T can be Node, Arc or Edge.

Change History (7)

comment:1 Changed 9 years ago by alpar

  • Owner changed from alpar to deba

comment:2 Changed 8 years ago by deba

  • Milestone changed from LEMON 1.1 release to LEMON 1.2 release

comment:3 follow-up: Changed 8 years ago by kpeter

Similar problem arises for functions, too. E.g. there are

      Node fromId(int, Node) const
      Edge fromId(int, Edge) const
      Arc fromId(int, Arc) const

      int maxId(Node) const
      int maxId(Edge) const
      int maxId(Arc) const

functions in the graph classes (with dummy parameters) to provide alternatives for
nodeFromId(), maxNodeId() etc. functions. However the above functions are not documented, they are only used in internal tools (like ItemSetTraits).

If the above question of the ticket is solved, then these functions could also be replaced by template functions that are specialized for Node, Arc and Edge types.

      template <typename Item>
      Item fromId(int) const

      template <typename Item>
      int maxId() const

So e.g. maxId<Node>() could be used as an alternative to maxNodeId() (instead of maxId(Node()), which is a bit strange).

What do you think?

comment:4 Changed 8 years ago by kpeter

More similar functions are the different versions of notifier().

comment:5 in reply to: ↑ 3 ; follow-up: Changed 8 years ago by deba

Replying to kpeter:

Similar problem arises for functions, too. E.g. there are

      Node fromId(int, Node) const
      Edge fromId(int, Edge) const
      Arc fromId(int, Arc) const

      int maxId(Node) const
      int maxId(Edge) const
      int maxId(Arc) const

functions in the graph classes (with dummy parameters) to provide alternatives for
nodeFromId(), maxNodeId() etc. functions. However the above functions are not documented, they are only used in internal tools (like ItemSetTraits).

If the above question of the ticket is solved, then these functions could also be replaced by template functions that are specialized for Node, Arc and Edge types.

      template <typename Item>
      Item fromId(int) const

      template <typename Item>
      int maxId() const

So e.g. maxId<Node>() could be used as an alternative to maxNodeId() (instead of maxId(Node()), which is a bit strange).

What do you think?

It isn't a good idea, because the template specialization is forbidden in class space. The only solution would be if the specialized function was also declared out of the class, and this helper function would be called from the member function.

comment:6 in reply to: ↑ 5 Changed 8 years ago by kpeter

Replying to deba:

It isn't a good idea, because the template specialization is forbidden in class space.

Thanks, I didn't know that.

comment:7 Changed 8 years ago by kpeter

  • Milestone LEMON 1.2 release deleted
Note: See TracTickets for help on using tickets.