Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Merged `compas.datastructures.Halfedge` into `compas.datastructures.Mesh`.
* Merged `compas.datastructures.Network` into `compas.datastructures.Graph`.

### Removed

* Removed `compas.datastructures.Network`.
* Removed `compas.datastructures.Halfedge`.

## [2.0.0-beta.2] 2024-01-12

Expand Down
7 changes: 0 additions & 7 deletions src/compas/datastructures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

from .graph.planarity import graph_embed_in_plane_proxy # noqa: F401

# =============================================================================
# Halfedges
# =============================================================================

# =============================================================================
# Meshes
# =============================================================================
Expand Down Expand Up @@ -52,7 +48,6 @@
# =============================================================================

from .graph.graph import Graph
from .halfedge.halfedge import HalfEdge
from .mesh.mesh import Mesh
from .halfface.halfface import HalfFace
from .volmesh.volmesh import VolMesh
Expand All @@ -67,8 +62,6 @@
__all__ = [
"Datastructure",
"CellNetwork",
"Graph",
"HalfEdge",
"Mesh",
"HalfFace",
"VolMesh",
Expand Down
14 changes: 5 additions & 9 deletions src/compas/datastructures/graph/planarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
from compas.geometry._core.predicates_2 import is_intersection_segment_segment_xy


def graph_embed_in_plane_proxy(data, fixed=None, straightline=True):
def graph_embed_in_plane_proxy(data, fixed=None):
from compas.datastructures import Graph

graph = Graph.from_data(data)
graph_embed_in_plane(graph, fixed=fixed, straightline=straightline)
graph_embed_in_plane(graph, fixed=fixed)
return graph.to_data()


Expand Down Expand Up @@ -181,8 +181,7 @@ def graph_is_planar(graph):
print("NetworkX is not installed.")
raise

nxgraph = graph.to_networkx()
return nx.is_planar(nxgraph)
return nx.is_planar(graph.to_networkx())


def graph_is_planar_embedding(graph):
Expand All @@ -203,7 +202,7 @@ def graph_is_planar_embedding(graph):
return graph_is_planar(graph) and graph_is_xy(graph) and not graph_is_crossed(graph)


def graph_embed_in_plane(graph, fixed=None, straightline=True):
def graph_embed_in_plane(graph, fixed=None):
"""Embed the graph in the plane.

Parameters
Expand All @@ -212,8 +211,6 @@ def graph_embed_in_plane(graph, fixed=None, straightline=True):
A graph object.
fixed : [hashable, hashable], optional
Two fixed points.
straightline : bool, optional
If True, embed using straight lines only.

Returns
-------
Expand Down Expand Up @@ -247,8 +244,7 @@ def graph_embed_in_plane(graph, fixed=None, straightline=True):

count = 100
while count:
graph = nx.Graph(edges)
pos = nx.spring_layout(graph, iterations=100, scale=max(xspan, yspan))
pos = nx.spring_layout(nx.Graph(edges), iterations=100, scale=max(xspan, yspan))
if not _are_edges_crossed(edges, pos):
is_embedded = True
break
Expand Down
Empty file.
Loading