Learn R Programming

pcds (version 0.1.4)

Gam2PEtri: The indicator for two points constituting a dominating set for Proportional Edge Proximity Catch Digraphs (PE-PCDs) - one triangle case

Description

Returns \(I(\){pt1,pt2} is a dominating set of the PE-PCD\()\) where the vertices of the PE-PCD are the 2D data set Dt), that is, returns 1 if {pt1,pt2} is a dominating set of PE-PCD, returns 0 otherwise.

Point, pt1, is in the region of vertex rv1 (default is NULL) and point, pt2, is in the region of vertex rv2 (default is NULL); vertices (and hence rv1 and rv2) are labeled as \(1,2,3\) in the order they are stacked row-wise in tri.

PE proximity regions are defined with respect to the triangle tri and vertex regions are based on center \(M=(m_1,m_2)\) in Cartesian coordinates or \(M=(\alpha,\beta,\gamma)\) in barycentric coordinates in the interior of the triangle tri or circumcenter of tri; default is \(M=(1,1,1)\) i.e., the center of mass of tri.

ch.data.pnts is for checking whether points pt1 and pt2 are data points in Dt or not (default is FALSE), so by default this function checks whether the points pt1 and pt2 would be a dominating set if they actually were in the data set.

See also (ceyhan:Phd-thesis,ceyhan:masa-2007,ceyhan:dom-num-NPE-Spat2011,ceyhan:mcap2012;textualpcds).

Usage

Gam2PEtri(
  pt1,
  pt2,
  Dt,
  tri,
  r,
  M = c(1, 1, 1),
  rv1 = NULL,
  rv2 = NULL,
  ch.data.pnts = FALSE
)

Value

\(I(\){pt1,pt2} is a dominating set of the PE-PCD\()\) where the vertices of the PE-PCD are the 2D data set Dt), that is, returns 1 if {pt1,pt2} is a dominating set of PE-PCD, returns 0 otherwise

Arguments

pt1, pt2

Two 2D points to be tested for constituting a dominating set of the PE-PCD.

Dt

A set of 2D points which constitutes the vertices of the PE-PCD.

tri

Three 2D points, stacked row-wise, each row representing a vertex of the triangle.

r

A positive real number which serves as the expansion parameter in PE proximity region; must be \(\ge 1\).

M

A 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of the triangle tri or the circumcenter of tri; default is \(M=(1,1,1)\) i.e., the center of mass of tri.

rv1, rv2

The indices of the vertices whose regions contains pt1 and pt2, respectively. They take the vertex labels as \(1,2,3\) as in the row order of the vertices in tri (default is NULL for both).

ch.data.pnts

A logical argument for checking whether points pt1 and pt2 are data points in Dt or not (default is FALSE).

Author

Elvan Ceyhan

References

See Also

Gam2PEbastri, Gam2AStri, and Gam2PEtetra

Examples

Run this code
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
n<-10  #try also n<-20

set.seed(1)
dat<-runif.tri(n,Tr)$g

M<-as.numeric(runif.tri(1,Tr)$g)  #try also M<-c(1.6,1.0)

r<-1.5  #try also r<-2

Gam2PEtri(dat[1,],dat[2,],dat,Tr,r,M)
Gam2PEtri(dat[1,],dat[4,],dat,Tr,r,M)
Gam2PEtri(dat[4,],dat[4,],dat,Tr,r,M)

Gam2PEtri(dat[1,],c(1,2),dat,Tr,r,M)

Gam2PEtri(c(1,2),c(1,3),rbind(c(1,2),c(1,3)),Tr,r,M)

ind.gam2<-vector()
for (i in 1:(n-1))
  for (j in (i+1):n)
  {if (Gam2PEtri(dat[i,],dat[j,],dat,Tr,r,M)==1)
   ind.gam2<-rbind(ind.gam2,c(i,j))}
ind.gam2

#or try
rv1<-rv.tri.cent(dat[1,],Tr,M)$rv;
rv2<-rv.tri.cent(dat[2,],Tr,M)$rv
Gam2PEtri(dat[1,],dat[2,],dat,Tr,r,M,rv1,rv2)

#or try
rv1<-rv.tri.cent(dat[1,],Tr,M)$rv;
Gam2PEtri(dat[1,],dat[2,],dat,Tr,r,M,rv1)

#or try
rv2<-rv.tri.cent(dat[2,],Tr,M)$rv
Gam2PEtri(dat[1,],dat[2,],dat,Tr,r,M,rv2=rv2)

P1<-c(1.4,1)
P2<-c(1.6,1)
Gam2PEtri(P1,P2,dat,Tr,r,M)
Gam2PEtri(dat[1,],dat[2,],dat,Tr,r,M)

dat.fr<-data.frame(a=dat)
Gam2PEtri(P1,P2,dat.fr,Tr,r,M)

dat.fr<-data.frame(a=Tr)
Gam2PEtri(P1,P2,dat,dat.fr,r,M)

Gam2PEtri(dat[1,],c(1,2),dat,Tr,r,M,ch.data.pnts = FALSE)
#gives an error message if ch.data.pnts = TRUE
#since not both points, pt1 and pt2, are data points in Dt

Run the code above in your browser using DataLab