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

Add weighted edges and self loop edges to graphs #3945

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0d90722
Add a first dummy implementation of loop edges
ZynoXelek Sep 26, 2024
aeef7ff
Modify circle so that it is directed towards outwards the graph
ZynoXelek Sep 27, 2024
3360086
Set Line.set_points_by_ends default buff and path_arc values to self …
ZynoXelek Oct 1, 2024
390f51a
Improve self loop edges and fix animations as well as implementing it…
ZynoXelek Oct 1, 2024
09d70b1
Fix vertices' labels blending with the background when `labels=True` …
ZynoXelek Oct 1, 2024
b0f4b78
Add temporary dummy scene for graph testing
ZynoXelek Oct 1, 2024
0be1438
Fix variable names
ZynoXelek Oct 2, 2024
e784f8c
Add weighted edges
ZynoXelek Oct 2, 2024
810d7c7
Update temporary dummy graph scene
ZynoXelek Oct 2, 2024
f4c5a85
Rename private method
ZynoXelek Oct 2, 2024
11ecf4f
Make edges labels' types modular
ZynoXelek Oct 3, 2024
6a70545
Update dummy graph temporary example
ZynoXelek Oct 3, 2024
e64f762
Add temporary pull request message
ZynoXelek Oct 3, 2024
a0b0dfd
Improve self loop modularity over radius computation
ZynoXelek Oct 4, 2024
c0a9de2
Add custom color support for edges' labels and improve if-else statem…
ZynoXelek Oct 4, 2024
cb237c5
Update temporary graph scene to test the new features
ZynoXelek Oct 4, 2024
67f7e76
Fix positioning issue which triggered failure on `tests/test_graphica…
ZynoXelek Oct 4, 2024
fbe3d7a
Add graphical tests for self-loop edges and weighted edges for both D…
ZynoXelek Oct 4, 2024
8e3af57
Make comments uniform
ZynoXelek Oct 4, 2024
6eb415b
Remove temporary files
ZynoXelek Oct 4, 2024
80eb7e0
Add relevant docstring
ZynoXelek Oct 4, 2024
34e3132
Merge branch 'main' into Weighted-Edges-Graphs
ZynoXelek Oct 4, 2024
3ae651d
Improve methods documentation
ZynoXelek Oct 4, 2024
7b62d0c
Add an example and update existing ones
ZynoXelek Oct 4, 2024
b2fdc2f
Add support for bidirectional edges
ZynoXelek Oct 5, 2024
7121796
Add parameters to adapt self-loops edges for `Graph` objects
ZynoXelek Oct 5, 2024
1fa1f9c
Update tests
ZynoXelek Oct 5, 2024
2f87684
Merge branch 'Weighted-Edges-Graphs' of github.com:ZynoXelek/manim in…
ZynoXelek Oct 5, 2024
a2c5054
Add DiGraph example
ZynoXelek Oct 5, 2024
232a4cb
Fix rotation of edge labels for directed graphs
ZynoXelek Oct 6, 2024
fa7fbbd
Make self loop edges configuration possible
ZynoXelek Oct 6, 2024
21dc293
Update control data for graphical tests
ZynoXelek Oct 6, 2024
c537d23
Remove bidirectional support. Should be done in another PR.
ZynoXelek Oct 6, 2024
6c698f6
Add temporary weighted graph animation fix
ZynoXelek Oct 6, 2024
ab2e870
Improve configuration of weights and self-loops
ZynoXelek Oct 7, 2024
ddf0cc4
Update graph tests
ZynoXelek Oct 7, 2024
a3d012b
Update weight config keywords and add example
ZynoXelek Oct 7, 2024
6fbef6d
Add moving graph tests
ZynoXelek Oct 7, 2024
6d5f420
Remove forgotten TODO
ZynoXelek Oct 7, 2024
379f318
Fix documentation return types
ZynoXelek Oct 7, 2024
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
9 changes: 7 additions & 2 deletions manim/mobject/geometry/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def set_points_by_ends(
self,
start: Point3D | Mobject,
end: Point3D | Mobject,
buff: float = 0,
path_arc: float = 0,
buff: float = None, # 0 #?Why default value to 0? Shouldn't be `self.buff` instead?
path_arc: float = None, # 0 #?Why default value to 0? Shouldn't be `self.buff` instead?
) -> None:
"""Sets the points of the line based on its start and end points.
Unlike :meth:`put_start_and_end_on`, this method respects `self.buff` and
Expand All @@ -83,6 +83,11 @@ def set_points_by_ends(
path_arc
The angle of a circle spanned by this arc, by default 0 which is a straight line.
"""
if buff is None:
buff = self.buff
if path_arc is None:
path_arc = self.path_arc

self._set_start_and_end_attrs(start, end)
if path_arc:
arc = ArcBetweenPoints(self.start, self.end, angle=self.path_arc)
Expand Down
Loading
Loading