You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REQ] Public API for Graph Coloring and Color Balancing #1145
Expose graph coloring and color balancing functionality through a public Python API. Currently, users must access internal wp.context.runtime.core functions directly to use these features.
Motivation
Projects using Warp (including Newton) are currently forced to access internal APIs:
API deprecation: With Warp v1.11's API cleanup, these internal APIs are now deprecated, but no public alternative exists.
Code reusability: These algorithms are implemented in Warp's native C++ code, making them difficult for downstream projects to extract or reimplement in Python without significant effort.
Proposed API
One possible approach would be to add public Python wrappers that provide a clean, Pythonic interface:
# Example of a possible public APInum_colors=wp.graph_coloring(
offsets=graph.offsets,
indices=graph.indices,
colors=colors,
algorithm="mcs"# or "greedy"
)
max_min_ratio=wp.balance_coloring(
offsets=graph.offsets,
indices=graph.indices,
colors=colors,
num_colors=num_colors
)
Implementation Notes
The underlying C++ implementations already exist and are exposed via ctypes
Need to add Python wrappers that:
Accept Warp arrays instead of raw pointers
Provide string-based algorithm selection instead of requiring enum constants
Include proper docstrings with parameter descriptions and usage examples
Handle error cases gracefully
References
Current usage in Newton: newton/_src/sim/graph_coloring.py
Related to Warp v1.11 API cleanup: Internal APIs now emit deprecation warnings
Activity
Add graph coloring public API
Merge branch 'ccrouzet/NVIDIAgh-1145-coloring-api' into 'main'
christophercrouzet commentedon Feb 10, 2026
Addressed in commit b298117.
Add graph coloring public API