/sas-network-analysis

Code samples and materials for network analysis and network optimization with SAS or SAS Viya.

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Network Analysis

This is a home for network-related demos and examples.

Table of Contents

Overview

This repository contains examples and demonstrations of the network analysis capabilities available in SAS® Viya.

Prerequisites

  • SAS Viya
    • Visual Data Mining and Machine Learning license required for network algorithm execution
  • graphviz
    • for network visualizations
  • python>=3.6.5 and required packages
    • for jupyter notebook execution
    • packages used in this demo are given in requirements.txt

Installation

Quick Start

  • To clone this repository, use git clone <REPO_URL>
  • Modify common/conf/environment.txt with your CAS server information
    • provided by your SAS Viya system admistrator
  • Launch a SAS Studio window to run SAS scripts (*.sas)
  • Or, launch a jupyter notebook to run notebooks (*.ipynb)

Details

  • Clone the repository as specified under Quick Start above.
  • Install a fresh python environment using conda:
    • conda init bash
    • conda create --name network-analysis python=3.6.5
    • conda activate network-analysis
    • conda install -c sas-institute --file requirements.txt
  • Make the following modifications within common/conf/environment.txt to enable connections to a Cloud Analytic Services (CAS) server. Contact your SAS system administrator (or person who deployed SAS® Viya) for more information:
    • CAS_SERVER_HOST=set this to the hostname of your CAS server
    • CAS_SERVER_PORT=set this to the port of your CAS server

Running

  • If you intend to run the SAS language script versions of these demos:
    • Open SAS Studio in a web browser. Contact your SAS system administrator for the URL to access SAS Studio.
    • Navigate to the directory where you cloned this repository, and then navigate to the sas/ directory of the demo you wish to run.
    • Open the .sas script and run by clicking the run icon or pressing F3.
  • If you intend to run the Jupyter notebook versions of these demos:
    • First ensure that you are have the required python packages installed by using conda install -c conda-forge -c sas-institute --file requirements.txt from a terminal window (see the above details section for more context).
    • launch a jupyter notebook session by using jupyter notebook start from a terminal window.
    • after launching, use a web browser to connect to the displayed URL for your newly created Jupyter notebook server
    • navigate to the directory where you cloned this repository, and then navigate to the python/ directory of the demo you wish to run.
    • open the .ipynb notebook and then run the cells interactively by clicking the run button.

Viewing graphs with graphviz

The SAS language scripts in various examples and demos produce graph visualizations produced with graphviz, which are saved in files with the extension .dot. To View them, you can convert them to to a rendered format, such as .png, with the command dot -Tpng sample.dot > sample.png. If you do not have graphviz installed, there are also online graphviz viewers that may be used to convert your .dot file content to an image.

Contributing

We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project.

License

This project is licensed under the Apache 2.0 License.

Additional Resources

For more information, please visit the following:

Documentation

Blog Posts

SAS Global Forum