Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:58:00+00:00 2026-06-10T03:58:00+00:00

can someone show me an example of how to use the Boost Graph Library

  • 0

can someone show me an example of how to use the Boost Graph Library isomorphism function with vertex invariants? I’m looking at the example at http://www.boost.org/doc/libs/1_50_0/libs/graph/example/isomorphism.cpp, which uses degree_vertex_invariant(). However, I want to define my own invariant function and an example would really help me to understand how to do this.

Here are some more details:

I am defining a set of discrete attributes on vertices such that I can label each vertex with an integer. So I have a mapping from any vertex(g,v) to its invariant label, which is an unsigned int. These labels are not necessarily unique, i.e. several vertices in the same graph can share the same label. So suppose I define a function:

template <typename Graph>
unsigned discrete_vertex_invariant(const typename boost::graph_traits<Graph>::vertex_descriptor &v, const Graph &g)

I want to call isomorphism like this:

typename property_map<Graph, vertex_index_t>::type
      v1_index_map = get(vertex_index, g1),
      v2_index_map = get(vertex_index, g2);
vector<typename graph_traits<Graph>::vertex_descriptor> f(num_vertices(g1));

bool is_isomorphic = isomorphism(g1, g2,
   isomorphism_map(make_iterator_property_map(f.begin(), v1_index_map, f[0])),
   discrete_vertex_invariant, discrete_vertex_invariant
)) 

… but I get an error:

no matching function for call to ‘isomorphism(
...
 <unresolved overloaded function type>, <unresolved overloaded function type>)’

What is the correct way to define discrete_vertex_invariant()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:58:02+00:00Added an answer on June 10, 2026 at 3:58 am

    You can find here the definition of degree_vertex_invariant. It’s simply a function object with typedefs for result_type and argument_type that is expected to be called with each of the vertices of the graph and that also has a member called max that return an integer equal to the max value of your invariants plus one.

    A similar functor using your discrete_vertex_invariant function would look like this:

    template <typename Graph>
    class discrete_vertex_invariant_functor
    {
        typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;
        const Graph &graph;
    public:
        typedef unsigned int result_type;
        typedef vertex_t argument_type;
        discrete_vertex_invariant_functor(const Graph &g):graph(g){}
        result_type operator()(argument_type v)const
        {
            return discrete_vertex_invariant(v,graph);
        }
        result_type max()
        {
            return MAX_LABEL+1;
        }
    };
    
    //helper function to help with argument deduction
    template <typename Graph>
    discrete_vertex_invariant_functor<Graph> make_discrete_vertex_invariant(const Graph &g)
    {
        return discrete_vertex_invariant_functor<Graph>(g);
    }
    

    You could then invoke isomorphism using its named-parameter version:

    bool ret=isomorphism(g1, g2, 
                isomorphism_map(make_iterator_property_map(f.begin(), v1_index_map, f[0]))
                .vertex_invariant1(make_discrete_vertex_invariant(g1))
                .vertex_invariant2(make_discrete_vertex_invariant(g2))
             );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone show a quick example on how to use NSTask and NSPipe in
Can someone please show a simple, but complete example of how one could use
Can someone show me an example how to use getopts properly or any other
Can someone show me an example how to properly use the getRelativeDateTimeString() that is
Given the example below, can someone please show me how this could be called?
Can someone show me how to use the System.Numerics.BigInteger datatype? I tried using this
Can someone tell/show me how to use PHP inside PHP. I'm trying to make
Can someone provide for-dummies example of how to use `MonadRandom'? Currently I have code
I was wondering if someone can show me how to use the format method
Hi can someone show me an example of a multidimensional associative array in vb.net.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.