Customized aggregator for different edge attributes in to_simple transform & "max" aggregator
- Dominant language
- Python
- Stars
- 14.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## 🚀 Feature
I suggest allowing users to choose different aggregators for different edge attributes. "max" aggregator keeps the largest value. The new function declaration would look like:
```
def to_simple(g,
return_counts='count',
writeback_mapping=False,
copy_ndata=True,
copy_edata=False,
etypes=None,
aggregator="arbitrary"):
"""
...
etypes: List[str], optional
Specifies the edge types to apply on. If None, merge parallel edges of all edge types.
aggregator: Union[Dict[str, str], str] optional
Indicates how different edge attributes are aggregated. If a string is provided, apply on all attributes. If a dict is provided, apply 'value' agrgegator to 'key' attribute.
"""
```
## Motivation
Some graphs may have parallel edges with different timestamps. In the case where the users need only the latest one, to_simple(aggregator="max") may be handy. Another common case is when the users need to merge parallel edges of only some specific types.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.