cai-causal-graph 0.5.4.dev2__tar.gz → 0.5.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cai-causal-graph
3
- Version: 0.5.4.dev2
3
+ Version: 0.5.5
4
4
  Summary: A Causal AI package for causal graphs.
5
5
  Home-page: https://causalgraph.causalens.com/
6
6
  License: Apache-2.0
@@ -31,7 +31,7 @@ __all__ = [
31
31
  'VARIABLE_NAME',
32
32
  ]
33
33
 
34
- __version__ = '0.5.4.dev2'
34
+ __version__ = '0.5.5'
35
35
 
36
36
  from cai_causal_graph.causal_graph import CausalGraph, Skeleton
37
37
  from cai_causal_graph.time_series_causal_graph import TimeSeriesCausalGraph
@@ -741,6 +741,10 @@ class CausalGraph(HasIdentifier, HasMetadata, CanDictSerialize, CanDictDeseriali
741
741
  edge.destination
742
742
  )
743
743
 
744
+ # raise an error if reverse edge from destination to source has already been defined
745
+ if self._edges_by_source[destination].get(source) is not None:
746
+ raise CausalGraphErrors.ReverseEdgeExistsError()
747
+
744
748
  self._edges_by_source[source][destination] = edge
745
749
  self._edges_by_destination[destination][source] = edge
746
750
 
@@ -45,6 +45,9 @@ class CausalGraphErrors:
45
45
  class EdgeExistsError(Exception):
46
46
  """Error raised when edge already exists in the graph."""
47
47
 
48
+ class ReverseEdgeExistsError(Exception):
49
+ """Error raised when the reverse edge already exists in the graph."""
50
+
48
51
  class EdgeDoesNotExistError(Exception):
49
52
  """Error raised when edge does not exist in the graph."""
50
53
 
@@ -42,7 +42,7 @@ cache_dir = '/dev/null'
42
42
 
43
43
  [tool.poetry]
44
44
  name = "cai-causal-graph"
45
- version = "0.5.4.dev2"
45
+ version = "0.5.5"
46
46
  description = "A Causal AI package for causal graphs."
47
47
  license = "Apache-2.0"
48
48
  authors = ["causaLens <opensource@causalens.com>"]