Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basis set operation of graph #2

Closed
GoogleCodeExporter opened this issue Mar 23, 2015 · 7 comments
Closed

Basis set operation of graph #2

GoogleCodeExporter opened this issue Mar 23, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Wrapping the disjoint union, union and intersection for igraph. The
operator interface should also be supported.

Original issue reported on code.google.com by lau65...@gmail.com on 16 Jun 2009 at 2:38

@GoogleCodeExporter
Copy link
Author

Note that these operations have easy immediate operators but no inplace 
operators, so just wrap the operator& 
to the igraph_*** functions and define operator&= from operator&. No need to 
mess with the tempobj.hpp stuff 
(aside from ::std::move).

Original comment by kennytm@gmail.com on 16 Jun 2009 at 3:37

  • Added labels: OpSys-All, Component-Logic

@GoogleCodeExporter
Copy link
Author

The supporting operation should be disjoint union, union, intersection, 
difference,
complementer and compose. If we need to add the operator interface, what sohuld 
be
the corresponding operator? I think

union +
intersection *
difference -
complementer !

Also there is some problem about the name igraph_union. The corresponding name 
is the
union which is the reserved word. A replacement maybe merge_union or the 
union_merge.
Any suggestion?

Original comment by lau65...@gmail.com on 17 Jun 2009 at 4:28

@GoogleCodeExporter
Copy link
Author

@3:

merge(x,y) is fine.

And for the operator interface, what you're describing is the 
Pascal convention. For C++ we can overload the bitwise 
operators as:

Intersection = bit_and = &
Union (Merge) = bit_or = |
Disjoint union = bit_xor = ^
Complement = bit_not = ~

But difference can't be assigned. 

Both conventions are fine to me. 



Original comment by kennytm@gmail.com on 17 Jun 2009 at 9:31

@GoogleCodeExporter
Copy link
Author

Regarding r50,

I said no need to mess with the tempobj.hpp stuff.

For example, you have implemented Graph::intersect(x, y), you can define 
operator& as:

// in .hpp
RETRIEVE_TEMPORARY_CLASS(Graph) operator& (const Graph& x, const Graph& y) 
MAY_THROW_EXCEPTION;
// in .cpp
RETRIEVE_TEMPORARY_CLASS(Graph) operator& (const Graph& x, const Graph& y) 
MAY_THROW_EXCEPTION {
  return Graph::intersect(x, y);
}

and then the operator &= can be defined as
// in .cpp
Graph& Graph::operator&= (const Graph& other) MAY_THROW_EXCEPTION {
  return (*this = *this & other);
}

The IMPLEMENT_ stuff is only needed when &= is easier to define than &, but in 
this case it is just the 
opposite.

Original comment by kennytm@gmail.com on 18 Jun 2009 at 10:15

@GoogleCodeExporter
Copy link
Author

Also, could you please put your functions following the documentation order of 
igraph? The graph operation 
stuff is in Chapter 18, and that should be after the "Reading and Writing 
Graphs from and to Files" part (Chapter 
15).

Original comment by kennytm@gmail.com on 18 Jun 2009 at 10:52

@GoogleCodeExporter
Copy link
Author

Thanks, I have written the operators before I found that it does not take 
advantage
of move semantic. Forget.

All graph operations and 5 operators (^ | & - ~) are added. After writing a test
program, this issue will be marked close.

I will add others after I finish my thesis.

Original comment by lau65...@gmail.com on 18 Jun 2009 at 4:04

@GoogleCodeExporter
Copy link
Author

Test cases added. 

Original comment by lau65...@gmail.com on 20 Jun 2009 at 11:36

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant