Skip to content

Commit

Permalink
Default to not laying out characters on creation; fix graphs specifie…
Browse files Browse the repository at this point in the history
…d as dicts
  • Loading branch information
clayote committed Jul 1, 2024
1 parent 22bd9e2 commit 9f5480a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion LiSE/LiSE/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ def _advance(self) -> Any:
def new_character(self,
name: Key,
data: Graph = None,
layout: bool = True,
layout: bool = False,
**kwargs) -> Character:
"""Create and return a new :class:`Character`."""
self.add_character(name, data, layout, **kwargs)
Expand Down Expand Up @@ -1627,6 +1627,11 @@ def add_character(self,
if kwargs:
if not data:
data = DiGraph()
if not isinstance(data, DiGraph):
try:
data = nx.from_dict_of_dicts(data)
except AttributeError:
data = nx.from_dict_of_lists(data)
data.graph.update(kwargs)
self._init_graph(name, 'DiGraph', data)
self._graph_objs[name] = self.char_cls(self, name)
Expand Down

0 comments on commit 9f5480a

Please sign in to comment.