<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Transitive Dependency Finder using code in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805359#M3704</link>
    <description>&lt;P&gt;Here is an approach that uses Viya's OPTNETWORK to solve it. This uses the same algorithms that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;shows through the OPTMODEL interface. It finds the connected components and then runs cycle detection by group (where group = connected component). &lt;BR /&gt;&lt;BR /&gt;For large scale this approach would scale nicely as it does all the heavy work on the server (either shared or distributed memory).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Find weakly connected components (ignore singletons) */
proc optnetwork
   links    = sascas1.have(where=(col2 ne ''))
   outLinks = sascas1.ConCompLinks;
   connectedComponents;
   linksVar from=col1 to=col2;
run;

/* Determine if the component is directed acyclic. */ 
proc optnetwork
   direction = directed
   links     = sascas1.ConCompLinks;
   linksVar from=col1 to=col2;
   cycle;
   displayout
      SolutionSummary = SolutionSummary;
   by concomp;
run;

/* For each component that is not acyclic, its nodes are NotOk (and append singletons as Ok). */
proc sql;
   create table tmp as
   select a.*, b.numCycles as hasCycle
   from sascas1.ConCompLinks as a left join sascas1.SolutionSummary as b
   on a.concomp = b.concomp;
quit;
data want;
   set tmp sascas1.have(where=(col2 eq ''));
   if(hasCycle &amp;gt; 0) then flag="NotOk"; else flag="Ok";
run;
proc print data=want; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 16:34:21 GMT</pubDate>
    <dc:creator>Matthew_Galati</dc:creator>
    <dc:date>2022-03-31T16:34:21Z</dc:date>
    <item>
      <title>Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/804988#M3687</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its plain transitive dependency finder task for me but somehow I am not able to generate the proper code&lt;/P&gt;
&lt;P&gt;E.g. A depends on B and B depends on A so this combination is transitive . C depends on D , D depends on E and F , E depends on C so this combination is also transitive. So I need to flag out such records irrespective of how much is the depth&lt;/P&gt;
&lt;P&gt;Below is the sample data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input col1: $1. col2: $1.;&lt;BR /&gt;datalines;&lt;BR /&gt;A B&lt;BR /&gt;P Q&lt;BR /&gt;B A&lt;BR /&gt;C D&lt;BR /&gt;D E&lt;BR /&gt;D F&lt;BR /&gt;E C&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;R&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the output I want&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15.0pt; width: 48pt;"&gt;col1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;col2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;flag&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;P&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Q&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Ok&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;D&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;F&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;E&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;NotOk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;R&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Ok&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is really appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 09:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/804988#M3687</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2022-03-30T09:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/804998#M3688</link>
      <description>&lt;P&gt;I can't quite figure out the logic here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A points to B and B points to A --&amp;gt; 'Not Ok'.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;P points to Q, but Q does not point back to P --&amp;gt; 'Ok'&lt;/LI&gt;
&lt;LI&gt;C points to D, D points to both E and F. Only E points back to C --&amp;gt; 'Not Ok'.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;How is the last case different from the second? There is still a loose 'end', as F does not point back to C?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 10:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/804998#M3688</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-30T10:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805000#M3689</link>
      <description>&lt;P&gt;Also, do you have SAS/OR?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 10:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805000#M3689</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-30T10:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805002#M3690</link>
      <description>It means if any of the element depends back to parent then it's transitive dependency. So third case has one element which points back to parent so it's not OK. First case does not have any dependency or missing dependency so it's OK</description>
      <pubDate>Wed, 30 Mar 2022 10:19:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805002#M3690</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2022-03-30T10:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805003#M3691</link>
      <description>No we don't have SAS/OR</description>
      <pubDate>Wed, 30 Mar 2022 10:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805003#M3691</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2022-03-30T10:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805004#M3692</link>
      <description>&lt;P&gt;Seem like each letter represents a node in a directed graph, and the rows indicate directed edges (or links). You want to find out if there is a cycle from one node back to itself by traversing other nodes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OPTGRAPH procedure in SAS/OR can solve these types of problems. It looks like there is a problem with the SAS documentation pages this morning, but you should be able (eventually) to get to the example from this page:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/en/software/optgraph-procedure-support.html#documentation" target="_blank"&gt;SAS OPTGRAPH Procedure | SAS Support&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Here is a link to a very old (SAS/OR 14.1) page that shows how to perform transitive closure operations:&amp;nbsp;&lt;A href="https://support.sas.com/documentation/cdl/en/procgralg/68145/HTML/default/viewer.htm#procgralg_optgraph_examples13.htm" target="_blank"&gt;Example 1.13 Transitive Closure for Identification of Circular Dependencies in a Bug Tracking System :: SAS(R) OPTGRAPH Procedure 14.1: Graph Algorithms and Network Analysis&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 10:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805004#M3692</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-03-30T10:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805005#M3693</link>
      <description>&lt;P&gt;The best approach is to use one of the Opt Procedures in SAS/OR to solve the problem.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;provided links to examples.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do not have access to SAS/OR, the code written by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;in &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-find-all-connected-components-in-a-graph/ta-p/231539" target="_self"&gt;this link&lt;/A&gt; can probably be tweaked to solve the problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 10:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805005#M3693</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-30T10:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805018#M3694</link>
      <description>&lt;P&gt;You want find a dead loop /&amp;nbsp;circle component?&lt;/P&gt;
&lt;P&gt;Here is an example .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;


data have;
infile datalines truncover;
input _start : $1. _end: $1.;
datalines;
A B
P Q
B A
C D
D E
D F
E C
R 
;
run;


data _null_;
if _n_ eq 1 then do;
length path _path  $ 800 ;

if 0 then set have;
declare hash ha(hashexp:20,dataset:'have(where=(_start is not missing and _end is not missing))',multidata:'y');
ha.definekey('_start');
ha.definedata('_end');
ha.definedone();

declare hash pa(ordered:'y');
declare hiter hi_path('pa');
pa.definekey('n');
pa.definedata('n','path');
pa.definedone();

end;

set have(where=(_start is not missing and _end is not missing));
count=1;n=1;_n=1;
path=catx(' ',_start,_end);
pa.add();
do while(hi_path.next()=0);

if n ne 1 then pa.remove(key:_n);_n=n;

_path=path;   
_start=scan(path,-1,' ');
rc=ha.find();
do while(rc=0);
  if not findw(path,strip(_end)) then do;

   if length(path)+length(_end)+1 gt lengthc(path) then do; put path= _end=;
    putlog 'ERROR: The length of path and _path are set too short';
    stop;
   end;
                                      count+1;n=count;
                                      path=catx(' ',path,_end);
                                      pa.add();
                                      path=_path;
                                     end;
     else do;put path= _end=;putlog 'FOUND:' _end 'is a circle component.';end;
  rc=ha.find_next();
end;
end;
pa.clear();
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;NOTE: 从数据集 WORK.HAVE. 读取了 7 个观测
      WHERE (_start is not null) and (_end is not null);
path=A B _end=A
FOUND:A is a &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;circle component&lt;/STRONG&gt;&lt;/FONT&gt;.
path=B A _end=B
FOUND:B is a circle component.
path=C D E _end=C
FOUND:C is a circle component.
path=D E C _end=D
FOUND:D is a circle component.
path=E C D _end=E
FOUND:E is a circle component.
NOTE: 从数据集 WORK.HAVE. 读取了 7 个观测
      WHERE (_start is not null) and (_end is not null);
NOTE: “DATA 语句”所用时间（总处理时间）:
      实际时间          0.19 秒
      CPU 时间          0.12 秒

&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 12:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805018#M3694</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-30T12:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805045#M3696</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code works correctly as per requirement for given sample but it doesnt work for the actual data. Attached is the actual dataset. I should have flag for&amp;nbsp;21-BSE-CUST_WBC-00001&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it doesnt show anything . Can you please check where I am doing wrong&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 13:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805045#M3696</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2022-03-30T13:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805098#M3697</link>
      <description>&lt;P&gt;Here's an approach that uses the network solver in PROC OPTMODEL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines truncover;
   input col1: $1. col2: $1.;
   datalines;
A B
P Q
B A
C D
D E
D F
E C
R 
;

proc optmodel printlevel=0;
   /* read input data */
   set &amp;lt;str,str&amp;gt; LINKS_ORIG;
   read data have into LINKS_ORIG=[col1 col2];
   set &amp;lt;str&amp;gt; NODES;
   NODES = (union {&amp;lt;i,j&amp;gt; in LINKS_ORIG} {i,j}) diff {''};
   set &amp;lt;str,str&amp;gt; LINKS;
   LINKS = {&amp;lt;i,j&amp;gt; in LINKS_ORIG: {i,j} within NODES};

   /* find weakly connected components */
   num component {NODES};
   solve with network / concomp direction=undirected nodes=(include=NODES) links=(include=LINKS) out=(concomp=component);
   set COMPONENTS;
   COMPONENTS = 1.._OROPTMODEL_NUM_['NUM_COMPONENTS'];
   set &amp;lt;str&amp;gt; NODES_c {COMPONENTS} init {};
   num compThis;
   for {i in NODES} do;
      compThis = component[i];
      NODES_c[compThis] = NODES_c[compThis] union {i};
   end;

   /* for each component, find a directed cycle if possible */
   num okNode {NODES} init 1;
   cofor {c in COMPONENTS: card(NODES_c[c]) &amp;gt; 1} do;
      put c=;
      solve with network / cycle direction=directed links=(include=LINKS) subgraph=(nodes=NODES_c[c]);
      if _OROPTMODEL_NUM_['NUM_CYCLES'] then for {i in NODES_c[c]} okNode[i] = 0;
   end;

   /* create output data set */
   create data want from [col1 col2]=LINKS_ORIG flag=(if okNode[col1] then 'Ok' else 'NotOk');
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 16:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805098#M3697</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2022-03-30T16:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805181#M3700</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;.. u r GOD... super awesomely working.....</description>
      <pubDate>Thu, 31 Mar 2022 01:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805181#M3700</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2022-03-31T01:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805240#M3701</link>
      <description>&lt;PRE&gt;I check RobPrat's code result . And found they are all 'Ok'. That means your data don't have any circle component.

You don't see anything in LOG ,that means your data don't have any circle component.(a.k.a My code is right).

if you think 21-BSE-CUST_WBC-00001  is a circle component. Could you show the path in your data ?&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 11:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805240#M3701</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-31T11:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805252#M3702</link>
      <description>&lt;P&gt;Just a clarification on Rick's comment. PROC OPTGRAPH is not part of SAS/OR, but PROC OPTNET is:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/ornoaug/ornoaug_optnet_details40.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/ornoaug/ornoaug_optnet_details40.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also get transitive closure, cycle, and connected components in Viya in &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_024/casmlnetwork/casmlnetwork_network_overview.htm" target="_self"&gt;PROC NETWORK&lt;/A&gt; (in Visual Data Mining and Machine Learning) or &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_024/casnopt/casnopt_optnet_overview.htm" target="_self"&gt;PROC OPTNETWORK&lt;/A&gt; (in Optimization).&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 12:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805252#M3702</guid>
      <dc:creator>Matthew_Galati</dc:creator>
      <dc:date>2022-03-31T12:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805311#M3703</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15140"&gt;@Matthew_Galati&lt;/a&gt;&amp;nbsp;, learned something new. Thanks! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 14:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805311#M3703</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-31T14:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Transitive Dependency Finder using code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805359#M3704</link>
      <description>&lt;P&gt;Here is an approach that uses Viya's OPTNETWORK to solve it. This uses the same algorithms that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;shows through the OPTMODEL interface. It finds the connected components and then runs cycle detection by group (where group = connected component). &lt;BR /&gt;&lt;BR /&gt;For large scale this approach would scale nicely as it does all the heavy work on the server (either shared or distributed memory).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Find weakly connected components (ignore singletons) */
proc optnetwork
   links    = sascas1.have(where=(col2 ne ''))
   outLinks = sascas1.ConCompLinks;
   connectedComponents;
   linksVar from=col1 to=col2;
run;

/* Determine if the component is directed acyclic. */ 
proc optnetwork
   direction = directed
   links     = sascas1.ConCompLinks;
   linksVar from=col1 to=col2;
   cycle;
   displayout
      SolutionSummary = SolutionSummary;
   by concomp;
run;

/* For each component that is not acyclic, its nodes are NotOk (and append singletons as Ok). */
proc sql;
   create table tmp as
   select a.*, b.numCycles as hasCycle
   from sascas1.ConCompLinks as a left join sascas1.SolutionSummary as b
   on a.concomp = b.concomp;
quit;
data want;
   set tmp sascas1.have(where=(col2 eq ''));
   if(hasCycle &amp;gt; 0) then flag="NotOk"; else flag="Ok";
run;
proc print data=want; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 16:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Transitive-Dependency-Finder-using-code/m-p/805359#M3704</guid>
      <dc:creator>Matthew_Galati</dc:creator>
      <dc:date>2022-03-31T16:34:21Z</dc:date>
    </item>
  </channel>
</rss>

