Skip to content

Commit

Permalink
Merge branch 'cython-base' to add basic Cython Adjacency Mapping grap…
Browse files Browse the repository at this point in the history
…h (see issue #2)
  • Loading branch information
maxfischer2781 committed Aug 7, 2018
2 parents 839c1fb + dee3c65 commit 0671ee5
Show file tree
Hide file tree
Showing 9 changed files with 20,512 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore c files generated by Cython
*.c linguist-generated=true
4 changes: 3 additions & 1 deletion graphi/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ class AdjacencyList(dict, abc_collection.MutableMapping):
__slots__ = ('__weakref__',)


@AdjacencyList.register
class AdjacencyView(GraphView):
"""
View on the adjacency of edges for a node in a graph
Expand Down Expand Up @@ -572,3 +571,6 @@ def __len__(self):

def __contains__(self, node):
return edge.Edge(self._node, node) in self._graph


AdjacencyList.register(AdjacencyView)
19 changes: 19 additions & 0 deletions graphi/types/cython_graph/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from ...abc import Graph as GraphABC
from ..decorator import boundable, undirectable

from .plain_graph import CythonGraph as _PlainGraph


@boundable
@undirectable
class CythonGraph(GraphABC):
"""
Optimised Cython Graph Implementations
.. note:: This is an abstract class that merely picks the most suitable implementation.
"""
def __new__(cls, *args, **kwargs):
return _PlainGraph(*args, **kwargs)


CythonGraph.register(_PlainGraph)
Loading

0 comments on commit 0671ee5

Please sign in to comment.