Implementation of the t-graph package presented in the paper 'CallMine: Fraud Detection and Visualization of Million-Scale Call Graphs'.
Project description
Tgraph: A static and temporal graph analysis tool
This is an implementation/publishing of the tgraph module used in the paper 'CallMine: Fraud Detection and Visualization of Million-Scale Call Graphs'.
For more information see Callmine: Fraud Detection and Visualizaion of Million-Scale Call Graphs.
Installation
You can install this package from PyPI:
pip install tgraph
Usage
The package offers three main feature sets: Creating static/temporal graphs from edgelists (and outputting their features), generating useful plots from features, and automatically joining CSV files resulting from graph features.
Creating static/temporal graphs from edgelists
Creating a static graph
In order to create a static graph, the user must provide a CSV file containing the following expected headers:
- "source": The source node.
- "destination": The destination node.
- "measure": A value expressing the measure of connection from source to destination.
This can either be done through the terminal (in which case tgraph performs a simple print and outputs the features if the flag -v is set):
staticgraph path/to/my/file
# or
staticgraph -v path/to/my/file
Or inside a python script:
from tgraph import static_graph
my_graph = static_graph.StaticGraph("path/to/my/file")
# Will perform a print of the adjacency dataframe
my_graph.my_print()
# Will print the graph features as csv
my_graph.print_to_csv("/path/to/output/file")
# ...
Creating a temporal graph
In order to create a static graph, the user must provide a CSV file containing the following expected headers:
- "source": The source node.
- "destination": The destination node.
- "measure": A value expressing the measure of connection from source to destination.
- "timestamp": A value expressing the timestamp associated with this connection.
This can either be done through the terminal (in which case tgraph performs a simple print and outputs the features if the flag -v is set):
temporalgraph path/to/my/file
# or
temporalgraph -v path/to/my/file
Or inside a python script:
from tgraph import temporal_graph
my_graph = temporal_graph.TemporalGraph("path/to/my/file")
# Will perform a print of the adjacency dataframe
my_graph.my_print()
# Will print the graph features as csv
my_graph.print_to_csv("/path/to/output/file")
# ...
Generating plots from graph features
The nd_cloud class provides a number of automatically generated visualizations and plots from graph feature datasets. The user is encouraged to check the source-code from the github page in order to find their desired functionality.
The module can be called from the terminal using:
ndcloud path/to/my/file
With the following optional flags:
- -v | --verbose: Enables output verbosity. Default = False
- -m | --min_row_sum: Drop rows with smaller sum. Default = 0
- -p | --print: Print to png. Default = False
It can also be used inside a Python script:
from tgraph import nd_cloud
ndc = nd_cloud.nd_cloud("path/to/my/file")
# Will simply print the headers
ndc.print_headers()
# Will produce ALL the plots
# You can set verbose to 0, print_flag to False and min_row_sum to 0 to get default behavior
ndc.kitchen_sink(verbose, print_flag, min_row_sum)
# Check out the nd_cloud class in the github repository for additional methods
Joining feature files
In order to join CSV feature files generated by the static and temporal graphs, the user can call the module from the terminal (with the optional -v flag):
joinfeaturefiles /path/to/static/file/ /path/to/temporal/file
# or
joinfeaturefiles -v /path/to/static/file/ /path/to/temporal/file
Alternatively, the module can also be used inside a Python script:
from tgraph import join_feature_files
jf = join_feature_files.JoinFeatures("path/to/static/file", "path/to/temporal/file")
jf.print_to_csv("path/to/output/file")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tgraph-1.0.1.tar.gz.
File metadata
- Download URL: tgraph-1.0.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2425182f81548cc0f3a9a0c0f5f7590ef347ab327b7d2835533d20250de8ae3b
|
|
| MD5 |
e3e6ddcd9e4c1c02eb908bceab074998
|
|
| BLAKE2b-256 |
165f2febb0676128f162e1c63b3e59dd680e9710af819e2963f74de97c3e0e0e
|
File details
Details for the file tgraph-1.0.1-py3-none-any.whl.
File metadata
- Download URL: tgraph-1.0.1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43d62a5a288d2f592483cec28f9cbc28590bce52a88bf320112cfc3d9918f544
|
|
| MD5 |
9b1b0015899dc48b88052a19e94b847a
|
|
| BLAKE2b-256 |
3f1a7c238046bb7225a0e2d1fd194bbb2b1d9f7c89fd73698d395a516267217f
|