{ "cells": [ { "cell_type": "markdown", "id": "d0c9c1d0-ee11-48e5-9415-90d10b24d1fb", "metadata": {}, "source": [ "# Polytope analysis" ] }, { "cell_type": "markdown", "id": "9103d416-8dbc-4339-9db2-8320d0b3b8a0", "metadata": {}, "source": [ "## Computing kernel basis" ] }, { "cell_type": "markdown", "id": "d514cc11-d5e6-466e-b4ac-834e6d0aab0a", "metadata": {}, "source": [ "The graph edge kernel describes the degree of freedom of the feasible matching rates, if any." ] }, { "cell_type": "markdown", "id": "c2e029f0-82eb-49b7-a6b0-04b6582aa3e7", "metadata": {}, "source": [ "[Stochastic Matching](https://balouf.github.io/stochastic_matching/index.html) provides tools to compute and display the edge kernel." ] }, { "cell_type": "markdown", "id": "fe990b02-f922-47a1-acf9-70c3c1a41d4d", "metadata": {}, "source": [ "### Examples of 1-D kernels" ] }, { "cell_type": "markdown", "id": "0ac8f1c0-f940-46af-95cf-8203ed1e442e", "metadata": {}, "source": [ "#### Diamond" ] }, { "cell_type": "code", "execution_count": 1, "id": "6e547af1-0303-4ba3-bebc-e5150801c628", "metadata": { "execution": { "iopub.execute_input": "2025-09-26T18:31:58.043914Z", "iopub.status.busy": "2025-09-26T18:31:58.042915Z", "iopub.status.idle": "2025-09-26T18:31:59.275258Z", "shell.execute_reply": "2025-09-26T18:31:59.275258Z", "shell.execute_reply.started": "2025-09-26T18:31:58.043914Z" } }, "outputs": [ { "data": { "text/plain": [ "Kernels of a graph with 4 nodes and 5 edges.\n", "Node dimension is 0.\n", "Edge dimension is 1\n", "Type: Surjective-only\n", "Node kernel:\n", "[]\n", "Edge kernel:\n", "[[ 1 -1 0 -1 1]]" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import stochastic_matching as sm\n", "diamond = sm.CycleChain(names=[str(i) for i in [1, 2, 3, 4]])\n", "diamond.kernel" ] }, { "cell_type": "code", "execution_count": 2, "id": "d3eccc78-5605-4e7f-9e0d-6ab22b0a3385", "metadata": { "execution": { "iopub.execute_input": "2025-09-26T18:31:59.276700Z", "iopub.status.busy": "2025-09-26T18:31:59.275258Z", "iopub.status.idle": "2025-09-26T18:31:59.279707Z", "shell.execute_reply": "2025-09-26T18:31:59.279707Z", "shell.execute_reply.started": "2025-09-26T18:31:59.276700Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "